/**
 * Created by IntelliJ IDEA.
 * User: Liu Yuhong
 * 
 * Date: 12-11-12
 * Time: 下午5:46
 * Schedule page
 */

var ie7 = $.browser.msie && $.browser.version == 7;
var tableHeight = 0, scrollWidth = 0; scrollHeight = 0;
$(function() {
	var cltcdol = 1;
	var zogsijian = 1;
	var fig = 1;
	var shiqujd = null;
	reset();
	$(window).bind('resize', reset);

	fixBar();
	var diogei = 1;
	$(window).scroll(function() {
		$(".scroll_row").scrollLeft($(this).scrollLeft());
		$("#scheduleBody").scrollTop($(this).scrollTop());
	});

	$("ul li").bind('mouseenter', function() {
		$(".editable").removeClass("editable").blur();
		$("#confirmDirectly").hide();
		$("#confirmDirectlyorder").hide();
		$("#confirmDirectlytj").hide();//
		if(shiqujd != null){
			var clssconew = shiqujd.find("span:eq(0)").attr("class");
			if("iconorder" != clssconew){
				shiqujd.prepend("<span class='iconorder'></span>");
			}
		}
	});
	var detailInput = $("#planDelivery"), thisInput, revertValue,thispcpkInput, revertpursValue,thisisqrInput, revertisqrValue,thisjdInput, revertjdValue, thiysfsInput, reverysfsValue,thicsInput, revercsValue,thidaweiInput, reverdanweiValue,tsInput, tsValue,jisuanmunInput, jisuanmunValue ,send_memoInput, send_memoValue,plandateInput, plandateValue,wuprodInput, wuprodValue,srcdlInput,srcdlValue;
	var receiveInput = $("#planReceive");
	var transportInput = $("#planTransport");
	var trainNoInput = $("#planTrainNo");
	var detailInputtj = $("#planDeliverytj"), thisInputtj, revertValuetj,thispcpkInputtj, revertpursValuetj,thisisqrInputtj, revertisqrValuetj,thisjdInputtj, revertjdValuetj, thiysfsInputtj, reverysfsValuetj,thicsInputtj, revercsValuetj,thidaweiInputtj, reverdanweiValuetj,tsInputtj, tsValuetj,jisuanmunInputtj, jisuanmunValuetj ,send_memoInputtj, send_memoValuetj,plandateInputtj, plandateValuetj;
	var receiveInputtj = $("#planReceivetj");
	var transportInputtj = $("#planTransporttj");
	var trainNoInputtj = $("#planTrainNotj");
	var isstatusText = "cg";
	var tstext = "2012-12-12 12:12:12";
	var shjhnum1 = "";
	var shjhnum1tj = "";
	$(".srcxinxvalue").unbind("mouseenter").bind('mouseenter', function() {
		if(shiqujd != null){
			var clssconew = shiqujd.find("span:eq(0)").attr("class");
			if("iconorder" != clssconew){
				shiqujd.prepend("<span class='iconorder'></span>");
			}
		}
		var self = this;
		var iscontih =$(self).find("input:eq(6)").val();
		if(iscontih == "false"){
			$(self).find("input").addClass("editable");
		} 
		var shifsec =$(self).find("input:eq(13)").val();
		var iscommitziz =$(self).find("input:eq(6)").val();
		if(shifsec == "2" || shifsec == "3"){
			$("#confirmDirectly").hide();
			$("#confirmDirectlytj").hide();//
			if(iscommitziz == "false"){
				$("#confirmDirectlyorder").css( {
					'top' : $(self).offset().top + 45,
					'left' : $(self).offset().left + 85
				}).show();/*DAPIGU-调整详细位置  75   5*/
//				if($("#confirmDirectlyorder").find("#confirmChangeqra").length == 0){
//					$("#confirmDirectlyorder").find("#confirmDetailorder").append("<a href='#' id='confirmChangeqra' class='show_detail'>订单</a>");
//				}
				//$("#confirmDirectlyorder").find("#confirmChangeqra").show();/*DAPIGU-去掉单一订单确认按钮  75   5*/
				$("#confirmDirectlyorder").find("#confirmChangeqra").hide();
			} else if(iscommitziz == "true"){
				$("#confirmDirectlyorder").css( {
					'top' : $(self).offset().top + 45,
					'left' : $(self).offset().left + 85
				}).show();/*DAPIGU-调整详细位置  75   5*/
				$("#confirmDirectlyorder").find("#confirmChangeqra").hide();//
//				$("#confirmChangeqra")
//				$(self).find("span:eq(0)").remove();
				
			}
			var clssco = $(self).find("span:eq(0)").attr("class");
			if("iconorder" == clssco){
				$(self).find("span:eq(0)").remove();
			}
		} else {
			$("#confirmDirectlyorder").hide();//
		}
		shjhnum1 = $( self ).find("input:eq(0)").val();
		var zongshjhnumdanansm = "";
		if(zogsijian == 0){
			var inpuidsm = $( self ).find("input:eq(0)").attr("id");
	    	var newidsm = inpuidsm.substring(0,4) + ""+inpuidsm.substring(6)
	    	var zongshjhnumsm = $( "#"+newidsm ).text();
	    	for ( var ism = 0; ism < zongshjhnumsm.length; ism++) {
	    		var spl = (ism+1);
	    		if(!isNaN(zongshjhnumsm.substring(0,zongshjhnumsm.length-spl))){
	    			var zongshjhnumdanweism = zongshjhnumsm.substring(zongshjhnumsm.length-spl);
	    			zongshjhnumdanansm = zongshjhnumsm.substring(0,zongshjhnumsm.length-spl);
				break;
				}
			}
    	}
		$("#confirmDetailorder").unbind("click").bind('click', function() {
			var thispcpkInputnew = $(self).find("input:eq(1)");
			var revertpursValuenew = thispcpkInputnew.val();
			$.ajax({
				type: "get",
		        url:"/ebvp/login/loginsuppname",
		        async: false,
		        data:"",
		        success:function(msg) {
							if (msg != "suppName") {
								window.location.href='/ebvp/login/loginOut';
							} else {
								if(($.browser.msie && $.browser.version == 7) ||($.browser.msie && $.browser.version == 8.0) || ($.browser.msie && $.browser.version == 7.0) || ($.browser.msie && $.browser.version == 8)|| ($.browser.msie && $.browser.version == 9)||($.browser.msie && $.browser.version == 9.0)){
			   	var scrWidth=screen.availWidth;
			   	var scrHeight=screen.availHeight;
				window.open(revertpursValuenew,"newwindows","resizable=yes,toolbar=yes, menubar=yes,   scrollbars=yes,location=yes, status=yes,top=0,left=0,width="+scrWidth+",height="+scrHeight);
			} else {
				window.open(revertpursValuenew);
			}				
							}
						}
			});
		});
		
		$("#confirmChangeqra").unbind('click').bind('click', function() {
//			alert("fsdfsdafsa111112221");
//			return false;
			var wuprod = $( self ).find("input:eq(15)").val();//gdw数量
        	var shjhnum = $( self ).find("input:eq(0)").val();
        	var shjhnumjingd = $( self ).find("input:eq(3)").val();
        	shjhnum = subReduNumqud(shjhnum+"",shjhnumjingd);
        	var srclshjhnum = $( self ).find("input:eq(13)").val();
        	var jisuanshjhnum = $( self ).find("input:eq(12)").val();
        	//if(new Number(shjhnum) < 0){
        	if("undefined" == typeof(shjhnum) || new Number(shjhnum) < 0){
        		var msg1 = getLanMsg("0ec22420-000168");
        		var msg312 = getLanMsg("0ec22420-000175");
        		showCfmMsg(msg312,msg1);
        		return false;
        	}
        	var iscgnum = $("#iscgnum").val();
        	var sysinitnum = $("#sysinitnum").val();
        	var jisuanrcvalue = sysinitnum;
        	if(iscgnum == "false"){
        		var newjisuanshjhnuma = new Number(jisuanshjhnum) + new Number(jisuanshjhnum) * (jisuanrcvalue/100);
        		if(1==1||srclshjhnum != "2"){
	        		if(new Number(shjhnum) > new Number(newjisuanshjhnuma)){
	        			if(jisuanrcvalue == 0){
	        				var msg1 = getLanMsg("0ec22420-000233");
	        				var msg312 = getLanMsg("0ec22420-000175");
	        				showCfmMsg(msg312,wuprod+msg1);
	        			} else {
	        				var msg1 = getLanMsg("0ec22420-000169");
	        				var m1g31 = getLanMsg("0ec22420-000175");
	        				showCfmMsg(m1g31,wuprod+msg1+ jisuanrcvalue +"%");
	        			}
	        			return false;
	        		}
        		}
        	}
        	$( self ).find("input:eq(0)").val(shjhnum);
        	if(zogsijian == 0){
				var inpuid = $( self ).find("input:eq(0)").attr("id");
	        	var newid = inpuid.substring(0,4) + ""+inpuid.substring(6)
	        	var zongshjhnum = $( "#"+newid ).text();
	        	for ( var i = 0; i < zongshjhnum.length; i++) {
	        		var spl = (i+1);
	        		if(!isNaN(zongshjhnum.substring(0,zongshjhnum.length-spl))){
	        			var zongshjhnumdanwei = zongshjhnum.substring(zongshjhnum.length-spl);
	    			var newzongshjhmun = new Number(zongshjhnumdanansm) + (new Number(shjhnum) - new Number(shjhnum1));
	    			$( "#"+newid ).text(subReduNumqud(newzongshjhmun+"",shjhnumjingd)+zongshjhnumdanwei);
	    			break;
	    			}
	    		}
        	}
        	var purscherule_pk = $( self ).find("input:eq(1)").val();
        	var isconfirm = $( self ).find("input:eq(2)").val();
        	var vehicle_ts = $( self ).find("input:eq(11)").val();
        	var purscherule_pknewa =  $("#purscherule_pk").val();
        	var onedatevaluqse = $("#onedate").val();
        	var bijpkordgzz = $("#bijpkorg").val();
        	var tpurscherule_pk = purscherule_pk.substring(0,22);
        	var wpurscherule_pk = purscherule_pk.substring(34,purscherule_pk.length);
        	purscherule_pk = tpurscherule_pk + wpurscherule_pk;
        	var pkorder = purscherule_pk.substring(30,50);
        	var pkorderitem = purscherule_pk.substring(63,83);
        	$.ajax({
				type: "POST",
		        url:"/ebvp/schedulecoll/paichengconller/paichengquerenorder",
		        async: false,
		        data:"purscherule_pkorde="+pkorder+"&pkitemorder="+pkorderitem+"&shjhnum="+shjhnum+"&pk_timecell_h="+purscherule_pk+"&isconfirm="+isconfirm+"&vehicle_ts="+vehicle_ts+"&onedate="+onedatevaluqse+"&purscherule_pknewa="+purscherule_pknewa + "&pk_org_cgs="+bijpkordgzz,
		        success: handleResponse
			});
        	//29 49  63  83
        	
        	if(isstatusText == 'success'){
        		$( self ).find("span").last().prev().prev().prev().removeClass("submited");
        		$( self ).find("span").last().prev().prev().prev().addClass("confirmed");
        		$( self ).removeClass("idAmountEditable");
        		$( self ).find("input:eq(2)").val("true");
        		$( self ).find("input:eq(11)").val(tstext);
        	} else {
        		var msg1 = getLanMsg("0ec22420-000170");
        		var mkdwi = getLanMsg("0ec22420-000175");
        		showCfmMsg(mkdwi,msg1);
        		return false;
        	}
			return false;
		});
		
		//$( ".srcxinxvalue" ).unbind("mouseleave").bind('mouseleave', function() {
		$( "input[name='shjhnum']" ).unbind("keyup").bind('keyup', function() {	
			//self = this;
			var sself = this;
        	var shjhnum = $( sself ).parent().find("input:eq(0)").val();
        	if(shjhnum == ""){
        		if(zogsijian == 0){
	        		var inpuid = $( sself ).parent().find("input:eq(0)").attr("id");
	        		var newid = inpuid.substring(0,4) + ""+inpuid.substring(6)
	            	var zongshjhnum = $( "#"+newid ).text();
	            	for ( var i = 0; i < zongshjhnum.length; i++) {
	            		var spl = (i+1);
	            		if(!isNaN(zongshjhnum.substring(0,zongshjhnum.length-spl))){
	            			var zongshjhnumdanwei = zongshjhnum.substring(zongshjhnum.length-spl);
	            			$( "#"+newid ).text(zongshjhnumdanwei);
	            			break;
	            		}
	            	}
            	}
        	} else {
        		if(zogsijian == 0){
        		var shjhnumnumScale = $( sself ).parent().find("input:eq(3)").val();
            	shjhnum = subReduNum(shjhnum,shjhnumnumScale);
            	$( sself ).parent().find("input:eq(0)").val(shjhnum);
	            	var inpuid = $( sself ).parent().find("input:eq(0)").attr("id");
	            	var newid = inpuid.substring(0,4) + ""+inpuid.substring(6)
	            	var zongshjhnum = $( "#"+newid ).text();
	            	for ( var i = 0; i < zongshjhnum.length; i++) {
	            		var spl = (i+1);
	            		if(!isNaN(zongshjhnum.substring(0,zongshjhnum.length-spl))){
	            			var zongshjhnumdanwei = zongshjhnum.substring(zongshjhnum.length-spl);
	            			//var zongshjhnumdanan = zongshjhnum.substring(0,zongshjhnum.length-spl);
	            			var newzongshjhmun = new Number(zongshjhnumdanansm) + (new Number(shjhnum) - new Number(shjhnum1));
	            			$( "#"+newid ).text(subReduNum(newzongshjhmun+"",shjhnumnumScale)+zongshjhnumdanwei);
	            			break;
	            		}
	            	}
            	}
        	}
        });
		$( ".srcxinxvalue" ).unbind("mouseleave").bind('mouseleave', function() {
			self = this;
			var shifsenew =$( self ).find("input:eq(13)").val();
    		if(shifsenew == "2" || shifsenew == "3"){
    			shiqujd = $( self );
    		} else {
    			shiqujd = null;
    		}
		});
	});
	var self = "";
	$(".idAmountEditable").unbind("mouseenter").bind('mouseenter', function() {
		self = this;
		$(self).find("input").addClass("editable");
		shjhnum1 = $( self ).find("input:eq(0)").val();
		var zongshjhnumdanansm = "";
		if(zogsijian == 0){
			var inpuidsm = $( self ).find("input:eq(0)").attr("id");
	    	var newidsm = inpuidsm.substring(0,4) + ""+inpuidsm.substring(6)
	    	var zongshjhnumsm = $( "#"+newidsm ).text();
	    	for ( var ism = 0; ism < zongshjhnumsm.length; ism++) {
	    		var spl = (ism+1);
	    		if(!isNaN(zongshjhnumsm.substring(0,zongshjhnumsm.length-spl))){
	    			var zongshjhnumdanweism = zongshjhnumsm.substring(zongshjhnumsm.length-spl);
	    			zongshjhnumdanansm = zongshjhnumsm.substring(0,zongshjhnumsm.length-spl);
				break;
				}
			}
    	}
		$("#confirmDirectlyorder").hide();//
		$("#confirmDirectlytj").hide();
			$("#confirmDirectly").css( {
				'top' : $(self).offset().top + 45,
				'left' : $(self).offset().left + 85
			}).show();/*DAPIGU-调整详细位置  75   5*/
			$("#confirmDirectly").find("#confirmChange").hide();/*DAPIGU-去掉单一订单确认  75   5*/
		$("#confirmChange").unbind('click').bind('click', function() {
			var wuprod1 = $( self ).find("input:eq(15)").val();//gdw数量
        	var shjhnum = $( self ).find("input:eq(0)").val();
        	var shjhnumjingd = $( self ).find("input:eq(3)").val();
        	shjhnum = subReduNumqud(shjhnum+"",shjhnumjingd);
        	var jisuanshjhnum = $( self ).find("input:eq(12)").val();
        	var srclshjhnum = $( self ).find("input:eq(13)").val();
        	if("undefined" == typeof(shjhnum) || new Number(shjhnum) < 0){
        	//if(new Number(shjhnum) < 0){
        		var msg26 = getLanMsg("0ec22420-000170");
        		var msg1 = getLanMsg("0ec22420-000168");
        		var hwi = getLanMsg("0ec22420-000175");
        		showCfmMsg(hwi,msg1);
        		return false;
        	}
        	var iscgnum = $("#iscgnum").val();
        	var sysinitnum = $("#sysinitnum").val();
        	var jisuanrcvalue = sysinitnum;
        	if(iscgnum == "false"){
        		var newjisuanshjhnuma = new Number(jisuanshjhnum) + new Number(jisuanshjhnum) * (jisuanrcvalue/100);
        		if(1==1||srclshjhnum != "2"){
	        		if(new Number(shjhnum) > new Number(newjisuanshjhnuma)){
	        			if(jisuanrcvalue == 0){
	        				var msg1 = getLanMsg("0ec22420-000233");
	        				var uiyh = getLanMsg("0ec22420-000175");
	        				showCfmMsg(uiyh,wuprod1+msg1);
	        			} else {
	        				var msg1 = getLanMsg("0ec22420-000169");
	        				var ouiq = getLanMsg("0ec22420-000175");
	        				showCfmMsg(ouiq,wuprod1+msg1+ jisuanrcvalue +"%");
	        			}
	        			return false;
	        		}
        		}
        	}
        	$( self ).find("input:eq(0)").val(shjhnum);
        	if(zogsijian == 0){
				var inpuid = $( self ).find("input:eq(0)").attr("id");
	        	var newid = inpuid.substring(0,4) + ""+inpuid.substring(6)
	        	var zongshjhnum = $( "#"+newid ).text();
	        	for ( var i = 0; i < zongshjhnum.length; i++) {
	        		var spl = (i+1);
	        		if(!isNaN(zongshjhnum.substring(0,zongshjhnum.length-spl))){
	        			var zongshjhnumdanwei = zongshjhnum.substring(zongshjhnum.length-spl);
	    			var newzongshjhmun = new Number(zongshjhnumdanansm) + (new Number(shjhnum) - new Number(shjhnum1));
	    			$( "#"+newid ).text(subReduNumqud(newzongshjhmun+"",shjhnumjingd)+zongshjhnumdanwei);
	    			break;
	    			}
	    		}
        	}
        	var purscherule_pk = $( self ).find("input:eq(1)").val();
        	var isconfirm = $( self ).find("input:eq(2)").val();
        	var vehicle_ts = $( self ).find("input:eq(11)").val();
        	var onedatevaluse = $("#onedate").val();
        	$.ajax({
				type: "POST",
		        url:"/ebvp/schedulecoll/paichengconller/paichengqueren",
		        async: false,
		        data:"shjhnum="+shjhnum+"&pk_timecell_h="+purscherule_pk+"&isconfirm="+isconfirm+"&vehicle_ts="+vehicle_ts+"&onedate="+onedatevaluse,
		        success: handleResponse
			});
        	if(isstatusText == 'success'){
        		$( self ).find("span").last().prev().prev().prev().removeClass("submited");
        		$( self ).find("span").last().prev().prev().prev().addClass("confirmed");
        		$( self ).removeClass("idAmountEditable");
        		$( self ).find("input:eq(2)").val("true");
        		$( self ).find("input:eq(11)").val(tstext);
        	} else {
        		var msg1 = getLanMsg("0ec22420-000170");
        		var jhmn = getLanMsg("0ec22420-000175");
        		showCfmMsg(jhmn,msg1);
        		return false;
        	}
			return false;
		});
		$( "input[name='shjhnum']" ).unbind("keydown").bind('keydown', function() { 
//			setTimeout(function(){
//				var sself = this;
//				shjhnum1 = $( sself ).parent().find("input:eq(0)").val();
//			},500);
		});
		$( "input[name='shjhnum']" ).unbind("keyup").bind('keyup', function() {
			var sself = this;
//			setTimeout(function(){
				//shjhnum1 = $( sself ).parent().find("input:eq(0)").val();
	        	var shjhnum = $( sself ).parent().find("input:eq(0)").val();
	        	
	        	if(shjhnum == ""){
	        		if(zogsijian == 0){
		              	var inpuid = $( sself ).parent().find("input:eq(0)").attr("id");
			        	var newid = inpuid.substring(0,4) + ""+inpuid.substring(6)
			        	var zongshjhnum = $( "#"+newid ).text();
			        	for ( var i = 0; i < zongshjhnum.length; i++) {
			        		var spl = (i+1);
			        		if(!isNaN(zongshjhnum.substring(0,zongshjhnum.length-spl))){
				        		var zongshjhnumdanwei = zongshjhnum.substring(zongshjhnum.length-spl);
			        			$( "#"+newid ).text(zongshjhnumdanwei);
			        			break;
			        		}
			        		
			        	}
	        		}
	        	} else {
	        		if(zogsijian == 0){
		        	var shjhnumnumScale = $( sself ).parent().find("input:eq(3)").val();
		        	shjhnum = subReduNum(shjhnum,shjhnumnumScale);
		        	$( sself ).parent().find("input:eq(0)").val(shjhnum);
			        	var inpuid = $( sself ).parent().find("input:eq(0)").attr("id");
			        	var newid = inpuid.substring(0,4) + ""+inpuid.substring(6)
			        	var zongshjhnum = $( "#"+newid ).text();
			        	for ( var i = 0; i < zongshjhnum.length; i++) {
			        		var spl = (i+1);
			        		if(!isNaN(zongshjhnum.substring(0,zongshjhnum.length-spl))){
			        			var zongshjhnumdanwei = zongshjhnum.substring(zongshjhnum.length-spl);
			        			//var zongshjhnumdanan = zongshjhnum.substring(0,zongshjhnum.length-spl);
			        			var newzongshjhmun = new Number(zongshjhnumdanansm) + (new Number(shjhnum) - new Number(shjhnum1));
			        			$( "#"+newid ).text(subReduNum(newzongshjhmun+"",shjhnumnumScale)+zongshjhnumdanwei);
			        			break;
			        		}
			        	}
		        	}
	        }
//			},500);
        });
		$("#confirmDetail").unbind("click").bind('click', function() {
			if ($.browser.mozilla)
				$( document.body ).css({ height: $( window ).height(), overflow: "hidden" });
			else {
				if (ie7)
					$(window).unbind('resize');
				$( 'html' ).css({ 'overflow': "hidden" });
			}
			var showTop = Math.abs($( window ).scrollTop() - $( "#scheduleEditerDetail" ).height()) - 8;
			$( "#scheduleEditerDetail" )
            .css({
                'top': showTop > $( window ).scrollTop() ? showTop : $( self ).offset().top - 50,
                'left': $( window ).width() - $( self ).offset().left + $( window ).scrollLeft() > $( "#scheduleEditerDetail" ).width() ?
                    $( self ).offset().left  : $( window ).width() - $( "#scheduleEditerDetail" ).width() + $( window ).scrollLeft()
            }).show();
			$( "#confirmDirectly" ).hide();
			thisInput = $(self).find("input:eq(0)");
			revertValue = thisInput.val();
			thispcpkInput = $(self).find("input:eq(1)");
			revertpursValue = thispcpkInput.val();
			thisisqrInput = $(self).find("input:eq(2)");
			revertisqrValue = thisisqrInput.val();
			thisjdInput = $(self).find("input:eq(3)");
			revertjdValue = thisjdInput.val();
			thiysfsInput = $(self).find("input:eq(4)");
			reverysfsValue = thiysfsInput.val();
			thicsInput = $(self).find("input:eq(5)");
			revercsValue = thicsInput.val();
			thidaweiInput = $(self).find("input:eq(7)");
			reverdanweiValue = thidaweiInput.val();
			tsInput = $(self).find("input:eq(11)");
			tsValue = tsInput.val();
			jisuanmunInput = $(self).find("input:eq(12)");
			jisuanmunValue = jisuanmunInput.val();
			send_memoInput = $(self).find("input:eq(9)");
			send_memoValue = send_memoInput.val();
			plandateInput = $(self).find("input:eq(14)");
			plandateValue = plandateInput.val();
			wuprodInput = $(self).find("input:eq(15)");
			wuprodValue = wuprodInput.val();
			srcdlInput = $(self).find("input:eq(13)");
			srcdlValue = srcdlInput.val();
			

			detailInput.css( {'color' : thisInput.css("color")}).val(thisInput.val());
			var spanvalue = thisInput.parents("li").find("span").last().prev().text();
			var spancolor = thisInput.parents("li").find("span").last().css("color");
			detailInput.next().css( {'color' : spancolor });
			detailInput.next().text("");
        	var lengd =0;
			for ( var i = 0; i < spanvalue.length; i++) {
        		var spl = (i+1);
        		if(!isNaN(spanvalue.substring(0,spanvalue.length-spl))){
        			var newspanvalue = spanvalue.substring(0,spanvalue.length-spl);
        			var newspanvalues = spanvalue.substring(spanvalue.length-spl);
        			lengd = newspanvalues.length -1;
        			receiveInput.val(newspanvalue);
        			lengd = reverdanweiValue.length -1;
        			receiveInput.val(spanvalue);
        			break;
        		}
        	}
//        	receiveInput.css({'width': 170 - lengd*10});
//        	detailInput.css({'width': 170 - lengd*10});
			transportInput.val(plandateValue);
			trainNoInput.val(send_memoValue);
			receiveInput.next().text("");
			return false;
		});
	});
	$(".idAmountEditablesn").unbind("mouseenter").bind('mouseenter', function() {
		var self = this;
		$("#confirmDirectlyorder").hide();//
		$("#confirmDirectly").hide();
		$("#confirmDirectlytj").css( {
			'top' : $(self).offset().top + 45,
			'left' : $(self).offset().left + 85
		}).show();/*DAPIGU-调整详细位置  75   5*/
		shjhnum1tj = $( self ).find("input:eq(0)").val();
		$("#confirmChange").unbind('click').bind('click', function() {
		});
		$( ".idAmountEditablesn" ).unbind("mouseleave").bind('mouseleave', function() {
			self = this;
			var shjhnum = $( self ).find("input:eq(0)").val();
			var shjhnumnumScale = $( self ).find("input:eq(3)").val();
			shjhnum = subReduNum(shjhnum,shjhnumnumScale);
			$( self ).find("input:eq(0)").val(shjhnum);
			if(zogsijian == 0){
				var inpuid = $( self ).find("input:eq(0)").attr("id");
				var newid = inpuid.substring(0,4) + ""+inpuid.substring(6)
				var zongshjhnum = $( "#"+newid ).text();
				for ( var i = 0; i < zongshjhnum.length; i++) {
					var spl = (i+1);
					if(!isNaN(zongshjhnum.substring(0,zongshjhnum.length-spl))){
						var zongshjhnumdanwei = zongshjhnum.substring(zongshjhnum.length-spl);
						var zongshjhnumdanan = zongshjhnum.substring(0,zongshjhnum.length-spl);
						var newzongshjhmun = new Number(zongshjhnumdanan) + (new Number(shjhnum) - new Number(shjhnum1tj));
						$( "#"+newid ).text(subReduNumqud(newzongshjhmun+"",shjhnumnumScale)+zongshjhnumdanwei);
						break;
					}
				}
			}
		});
		$("#confirmDetailtj").unbind("click").bind('click', function() {
			if ($.browser.mozilla)
				$( document.body ).css({ height: $( window ).height(), overflow: "hidden" });
			else {
				if (ie7)
					$(window).unbind('resize');
				$( 'html' ).css({ 'overflow': "hidden" });
			}
			var showTop = Math.abs($( window ).scrollTop() - $( "#scheduleEditerDetailtj" ).height()) - 8;
			$( "#scheduleEditerDetailtj" )
			.css({
				'top': showTop > $( window ).scrollTop() ? showTop : $( self ).offset().top - 50,
						'left': $( window ).width() - $( self ).offset().left + $( window ).scrollLeft() > $( "#scheduleEditerDetailtj" ).width() ?
								$( self ).offset().left  : $( window ).width() - $( "#scheduleEditerDetailtj" ).width() + $( window ).scrollLeft()
			}).show();
			$( "#confirmDirectlytj" ).hide();
			thisInputtj = $(self).find("input:eq(0)");
			revertValuetj = thisInputtj.val();
			thispcpkInputtj = $(self).find("input:eq(1)");
			revertpursValuetj = thispcpkInputtj.val();
			thisisqrInputtj = $(self).find("input:eq(2)");
			revertisqrValuetj = thisisqrInputtj.val();
			thisjdInputtj = $(self).find("input:eq(3)");
			revertjdValuetj = thisjdInputtj.val();
			thiysfsInputtj = $(self).find("input:eq(4)");
			reverysfsValuetj = thiysfsInputtj.val();
			thicsInputtj = $(self).find("input:eq(5)");
			revercsValuetj = thicsInputtj.val();
			thidaweiInputtj = $(self).find("input:eq(7)");
			reverdanweiValuetj = thidaweiInputtj.val();
			tsInputtj = $(self).find("input:eq(11)");
			tsValuetj = tsInputtj.val();
			jisuanmunInputtj = $(self).find("input:eq(12)");
			jisuanmunValuetj = jisuanmunInputtj.val();
			send_memoInputtj = $(self).find("input:eq(9)");
			send_memoValuetj = send_memoInputtj.val();
			plandateInputtj = $(self).find("input:eq(14)");
			plandateValuetj = plandateInputtj.val();
			detailInputtj.css( {'color' : thisInputtj.css("color")}).val(thisInputtj.val());
			var spanvalue = thisInputtj.parents("li").find("span").last().prev().text();
			var spancolor = thisInputtj.parents("li").find("span").last().css("color");
			detailInputtj.next().css( {'color' : spancolor });
//			detailInputtj.next().text(reverdanweiValuetj);
			detailInputtj.next().text("");
			var lengd =0;
			for ( var i = 0; i < spanvalue.length; i++) {
				var spl = (i+1);
				if(!isNaN(spanvalue.substring(0,spanvalue.length-spl))){
					var newspanvalue = spanvalue.substring(0,spanvalue.length-spl);
					var newspanvalues = spanvalue.substring(spanvalue.length-spl);
					//lengd = newspanvalues.length -1;
					//receiveInputtj.val(newspanvalue);
					lengd = reverdanweiValuetj.length -1;
					receiveInputtj.val(spanvalue);
					break;
				}
			}
//			receiveInputtj.css({'width': 170 - lengd*10});
//			detailInputtj.css({'width': 170 - lengd*10});
			transportInputtj.val(plandateValuetj);
			trainNoInputtj.val(send_memoValuetj);
//			receiveInputtj.next().text(reverdanweiValuetj);
			receiveInputtj.next().text("");
			return false;
		});
	});
	
	
	$("#detailConfirm").bind('click', function() { 
		var shjhnum = detailInput.val();
		shjhnum = subReduNum(shjhnum+"",revertjdValue)
		detailInput.val(shjhnum);
		if("undefined" == typeof(shjhnum) || new Number(shjhnum) < 0){
		//if(new Number(shjhnum) < 0){
			var msg1 = getLanMsg("0ec22420-000171");
			var xnbh = getLanMsg("0ec22420-000175");
    		showCfmMsg(xnbh,msg1);
    		return false;
    	}
		var iscgnum = $("#iscgnum").val();
		var sysinitnum = $("#sysinitnum").val();
		if(iscgnum == "false"){
			var jisuanrcvalue = sysinitnum;
			var newjisuanshjhnuma = new Number(jisuanmunValue) + new Number(jisuanmunValue) * (jisuanrcvalue/100);
			if(1==1||srcdlValue != "2"){
				if(new Number(shjhnum) > new Number(newjisuanshjhnuma)){
					if(jisuanrcvalue == 0){
						var msg1 = getLanMsg("0ec22420-000233");
						var poik = getLanMsg("0ec22420-000175");
						showCfmMsg(poik,wuprodValue+msg1);
					} else {
						var msg1 = getLanMsg("0ec22420-000169");
						var zxnj = getLanMsg("0ec22420-000175");
						showCfmMsg(zxnj,wuprodValue+msg1+ jisuanrcvalue +"%");
					}
					return false;
				}
			}
		}
		var send_memonew = trainNoInput.val();
		send_memonew = escape(encodeURIComponent(send_memonew));
		$.ajax({
			type: "POST",
	        url:"/ebvp/schedulecoll/paichengconller/paichengquerenxz",
	        async: false,
	        //contentType:"application/x-www-form-urlencoded;charset=UTF-8",
	        data:"shjhnum="+shjhnum
	        +"&pk_timecell_h="+revertpursValue
	        +"&isconfirm="+revertisqrValue
	        +"&transit_type="+transportInput.val()
	        +"&vehicle_seq="+trainNoInput.val()
	        +"&vehicle_ts="+tsValue
	        +"&send_memo="+send_memonew
	        +"&plandate="+transportInput.val(),
	        success: handleResponse
		});
		if(isstatusText == 'success'){
			thisInput.parents("li").find("span").last().prev().prev().prev().removeClass("submited");
			thisInput.parents("li").find("span").last().prev().prev().prev().addClass("confirmed");
			thisisqrInput.val("true");
			plandateInput.val(transportInput.val());
			send_memoInput.val(trainNoInput.val());
			detailInput.val(shjhnum);
			revertInput();
			
			if(zogsijian == 0){
				var inpuid = thisInput.attr('id');
		    	var newid = inpuid.substring(0,4) + ""+inpuid.substring(6)
		    	var zongshjhnum = $( "#"+newid ).text();
	        	for ( var i = 0; i < zongshjhnum.length; i++) {
	        		var spl = (i+1);
	        		if(!isNaN(zongshjhnum.substring(0,zongshjhnum.length-spl))){
	        	    	var zongshjhnumdanwei = zongshjhnum.substring(zongshjhnum.length-spl);
	        	    	var zongshjhnumdanan = zongshjhnum.substring(0,zongshjhnum.length-spl);
	        	    	var newzongshjhmun = new Number(zongshjhnumdanan) + (new Number(shjhnum) - new Number(revertValue));
	        	    	$( "#"+newid ).text(subReduNum(newzongshjhmun+"",revertjdValue)+zongshjhnumdanwei);
	        			break;
	        		}
	        	}
			}
        	thisInput.parents("li").find("input:eq(11)").val(tstext);
			$("#scheduleEditerDetail").hide();
		} else{
			$( "#confirmDetail" ).unbind('click');
			revertInput();
			thisInput.val(revertValue);
			$("#scheduleEditerDetail").hide();
			var msg1 = getLanMsg("0ec22420-000170");
			var bhyiu = getLanMsg("0ec22420-000175");
			showCfmMsg(bhyiu,msg1);
			return false;
		}
		return false;
	});
	$("#detailCancel").bind('click', function() {
		$( "#confirmDetail" ).unbind('click');
		revertInput();
		thisInput.val(revertValue);
		$("#scheduleEditerDetail").hide();
		return false;
	});
	$("#detailCanceltj").bind('click', function() {
		$( "#confirmDetailtj" ).unbind('click');
		revertInputtj();
		thisInputtj.val(revertValuetj);
		$("#scheduleEditerDetailtj").hide();
		return false;
	});
	function revertInput() {
		thisInput.val(detailInput.val());
		if($.browser.mozilla) {
			$( "body" ).css({ 'width': scrollWidth, 'height': scrollHeight, 'overflow': "auto" });
		} else {
			$( 'html' ).css({ 'overflow': "" });
		}
	}
	function revertInputtj() {
		thisInputtj.val(detailInputtj.val());
		if($.browser.mozilla) {
			$( "body" ).css({ 'width': scrollWidth, 'height': scrollHeight, 'overflow': "auto" });
		} else {
			$( 'html' ).css({ 'overflow': "" });
		}
	}
	var isstiauenitsjiw = 10;
	function handleResponse(responseText, statusText, xhr, $form){
			if(typeof(responseText.responseText) == "undefined"){
				responseText = xhr.responseText;
			}
			var successvalues = responseText.split("*");
			if(successvalues[0] == 'success'){
				isstatusText = "success";
				tstext = successvalues[1];
			} else {
				isstatusText = "cg";
			}
			if(successvalues[1] == 'fign'){
				isstiauenitsjiw = 20;
			}
	}
	$("#btn_grayqb").click(function() {
			var intfig = 0;
			var shifcsum = 0;
			var shulyanz = 0;
			var sysinitnum = $("#sysinitnum").val();
			var wuprod3 = "";
			var newwuprod3 = "";
			var srcvalueod = "1";
			$("input[name=iscommit]").each(function(index, obj){
				var displeyvalue = $(obj).parents(".data_amount_row").css("display");
				if("block" == displeyvalue){
					var iscommitvalue = $(obj).val();
					var jisuanvalue = $(obj).parent().find("input:eq(0)").val();
					var jsscheilpecheng = $(obj).parent().find("input:eq(1)").val();
					srcvalueod = $(obj).parent().find("input:eq(13)").val();
					var nextobj = $(obj).parent().parent().parent().find("span").last().prev();
					var nextvoaue = nextobj.text();
					if(nextvoaue != null && nextvoaue !="" && jisuanvalue != null && jisuanvalue!= "" && iscommitvalue == 'false'){
						intfig = intfig+1;
					}
					if(iscommitvalue == 'false'){
						var shjhnum = $(obj).parent().find("input:eq(0)").val();
			        	var jisuanshjhnum = $(obj).parent().find("input:eq(12)").val();
			        	var jisuanrcvalue = sysinitnum;
			        	if(shjhnum != null && shjhnum != ""){
			        	var newjisuanshjhnuma = new Number(jisuanshjhnum) + new Number(jisuanshjhnum) * (jisuanrcvalue/100);
			        	if(new Number(shjhnum) > new Number(newjisuanshjhnuma)){
			        		if(1==1||srcvalueod != "2"){
				        		shifcsum = shifcsum+1;
				        		wuprod3 = $(obj).parent().find("input:eq(15)").val();
				        		if(newwuprod3 == ""){
				        			newwuprod3 += wuprod3;
								} else {
									var valuesy = newwuprod3.split(",");
									var jisq = 0;
									for ( var rowsLoogp = 0; rowsLoogp < valuesy.length; rowsLoogp++) {
										if(valuesy[rowsLoogp] == wuprod3){
											jisq = 1;
										}
									}
									if(jisq == 0){
										newwuprod3 += ","+wuprod3;
									}
								}
			        		}
			        	} 
			        	}
			        	if(shjhnum != null && shjhnum != ""){
			        		if("undefined" == typeof(shjhnum) || new Number(shjhnum) < 0){
			        		//if(new Number(shjhnum) < 0){
			        			var msg1 = getLanMsg("0ec22420-000234");
			        			var uythw = getLanMsg("0ec22420-000175");
			            		showCfmMsg(uythw,msg1);
			            		shulyanz = shulyanz+1;
			        		}
			        	}
			        	if(jsscheilpecheng != null && jsscheilpecheng != ""){
			        		var qrqjavalue = $(obj).parent().attr("qrqja");
			        		if(qrqjavalue == "2"){
			        		if("undefined" == typeof(shjhnum) || "" == shjhnum){
				        		//showCfmMsg("提示","送货计划数量需大于等于0，请修改送货计划数量！");
			            		shulyanz = shulyanz+1;
				        	}
			        		}
			        	}
					}
				}
			});
			if(intfig == 0){
				if(shulyanz != 0){
					var msg1 = getLanMsg("0ec22420-000234");
					var uytqb = getLanMsg("0ec22420-000175");
					showCfmMsg(uytqb,msg1);
					return false;
				}
				var msg1 = getLanMsg("0ec22420-000173");
				var iuywn = getLanMsg("0ec22420-000175");
				showCfmMsg(iuywn,msg1);
				return false;
			}
			var iscgnum = $("#iscgnum").val();
			if(iscgnum == "false"){
				if(shifcsum != 0){
//					if(srcvalueod != "2"){
						if(sysinitnum == 0){
							var msg1 = getLanMsg("0ec22420-000233");
							var ijwind = getLanMsg("0ec22420-000175");
							showCfmMsg(ijwind,newwuprod3+msg1);
						} else {
							var msg1 = getLanMsg("0ec22420-000169");
							var iquen = getLanMsg("0ec22420-000175");
							showCfmMsg(iquen,newwuprod3+msg1+ sysinitnum +"%");
						}
						return false;
//					}
				}
			}
			if(shulyanz != 0){
				if(cltcdol == 0){
					var msg1 = getLanMsg("0ec22420-000234");
					var oeiekn = getLanMsg("0ec22420-000175");
					showCfmMsgsch(oeiekn,msg1);
					var formStr = "";
					var pk_org_cgstszz = $("#pk_org_cgsts").val();
					formStr += "pk_org_cgsts="+pk_org_cgstszz+"&";
					var sysinitnumzz = $("#sysinitnum").val();
					formStr += "sysinitnum="+sysinitnumzz+"&";
					var iscgnumzz = $("#iscgnum").val();
					formStr += "iscgnum="+iscgnumzz+"&";
					var dqdatezz = $("#dqdate").val();
					formStr += "dqdate="+dqdatezz+"&";
					var purscherule_pkzz = $("#purscherule_pk").val();
					formStr += "purscherule_pk="+purscherule_pkzz+"&";
					var bijpkorgzz = $("#bijpkorg").val();
					formStr += "pk_org_cgs="+bijpkorgzz+"&";
					
					$("label[id=abs]").each(function(index, obj){
						var inputobj = $(obj).find("input");
						var pk_timecell_hzs = $(inputobj[1]).val();
						var iscommitax = $(inputobj[6]).val();
						var shjhnumzxind = $(inputobj[0]).val();
						var displeyvalue = $(obj).parents(".data_amount_row").css("display");
						if("block" == displeyvalue && shjhnumzxind != "" && shjhnumzxind != null && pk_timecell_hzs != null && pk_timecell_hzs.length > 1 && iscommitax == 'false'){
							var srcxinxzz = $(inputobj[13]).val();
							formStr += "srcxinx="+srcxinxzz+"&";
							var isconfirmzz = $(inputobj[2]).val();
//							formStr += "isconfirm="+isconfirmzz+"&";
							var iscommitzz = $(inputobj[6]).val();
//							formStr += "iscommit="+iscommitzz+"&";
							var pk_timecell_hzz = $(inputobj[1]).val();
							if(pk_timecell_hzz != null){
//								var tpk_timecell_hzz = pk_timecell_hzz.substring(0,22);
//								var wpk_timecell_hzz = pk_timecell_hzz.substring(34,pk_timecell_hzz.length);
								var tpk_timecell_hzz = "";
								var wpk_timecell_hzz = "";
								if (pk_timecell_hzz.indexOf("editOrder") != -1){
									tpk_timecell_hzz = pk_timecell_hzz.substring(0,22);
									wpk_timecell_hzz = pk_timecell_hzz.substring(34,pk_timecell_hzz.length);
								} else {
									tpk_timecell_hzz = pk_timecell_hzz.substring(0,24);
									wpk_timecell_hzz = pk_timecell_hzz.substring(36,pk_timecell_hzz.length);
								}
								pk_timecell_hzz = tpk_timecell_hzz + wpk_timecell_hzz;
								pk_timecell_hzz = pk_timecell_hzz.replace("&","%26");
								pk_timecell_hzz = pk_timecell_hzz.replace("&","%26");
								pk_timecell_hzz = pk_timecell_hzz.replace("&","%26");
								pk_timecell_hzz = pk_timecell_hzz.replace("=","%3D");
								pk_timecell_hzz = pk_timecell_hzz.replace("=","%3D");
								pk_timecell_hzz = pk_timecell_hzz.replace("=","%3D");
							}
							formStr += "pk_timecell_h="+pk_timecell_hzz+"&";
							var shjhnumzz = $(inputobj[0]).val();
							formStr += "shjhnum="+shjhnumzz+"&";
							var vehicle_tszz = $(inputobj[11]).val();
							formStr += "vehicle_ts="+vehicle_tszz+"&";
						}
					});
					$.ajax( {
						url : "/ebvp/schedulecoll/paichengconller/paichengfomcitj",
						type : "POST",
						//data : formStr, 
						data:formStr,//$("#fomcitj").serialize(), 
						dataType : "text",
						async : false,
						success : function(msg) {
						}
					});
//					function showRespdiwn(responseText, statusText, xhr, $form){
//					}
//					if(1==1){
//						alert("fsdfsdfdsfsa");
////						return false;
//					}
					if(diogei == 1){
						var wulflvalue = $("#pk_marbasclass").val();
						$("#wulflvalueai").val(wulflvalue);
//					var newwulflvalue = wulflvalue.split(",");
						var wulflvaluename = $("#qrygoodsClass").val();
						$("#wulflvalueainame").val(wulflvaluename);
					}
					$("#fomcitj").attr("action","/ebvp/schedulecoll/paichengconller/paichengfomcitjzz");
			    	$("#fomcitj").submit();
					return false;
				} else {
					var msg1 = getLanMsg("0ec22420-000234");
					var oeiwnia = getLanMsg("0ec22420-000175");
					var option = {
							title : oeiwnia,
							content : msg1,
							confirm : function() {
						var formStr = "";
						var pk_org_cgstszz = $("#pk_org_cgsts").val();
						formStr += "pk_org_cgsts="+pk_org_cgstszz+"&";
						var sysinitnumzz = $("#sysinitnum").val();
						formStr += "sysinitnum="+sysinitnumzz+"&";
						var iscgnumzz = $("#iscgnum").val();
						formStr += "iscgnum="+iscgnumzz+"&";
						var dqdatezz = $("#dqdate").val();
						formStr += "dqdate="+dqdatezz+"&";
						var purscherule_pkzz = $("#purscherule_pk").val();
						formStr += "purscherule_pk="+purscherule_pkzz+"&";
						var bijpkorgzz = $("#bijpkorg").val();
						formStr += "pk_org_cgs="+bijpkorgzz+"&";
						
						$("label[id=abs]").each(function(index, obj){
							var inputobj = $(obj).find("input");
							var pk_timecell_hzs = $(inputobj[1]).val();
							var iscommitax = $(inputobj[6]).val();
							var shjhnumzxind = $(inputobj[0]).val();
							var displeyvalue = $(obj).parents(".data_amount_row").css("display");
							if("block" == displeyvalue && shjhnumzxind != "" && shjhnumzxind != null && pk_timecell_hzs != null && pk_timecell_hzs.length > 1 && iscommitax == 'false'){
								var srcxinxzz = $(inputobj[13]).val();
								formStr += "srcxinx="+srcxinxzz+"&";
								var isconfirmzz = $(inputobj[2]).val();
//								formStr += "isconfirm="+isconfirmzz+"&";
								var iscommitzz = $(inputobj[6]).val();
//								formStr += "iscommit="+iscommitzz+"&";
								var pk_timecell_hzz = $(inputobj[1]).val();
								if(pk_timecell_hzz != null){
//									var tpk_timecell_hzz = pk_timecell_hzz.substring(0,22);
//									var wpk_timecell_hzz = pk_timecell_hzz.substring(34,pk_timecell_hzz.length);
									var tpk_timecell_hzz = "";
									var wpk_timecell_hzz = "";
									if (pk_timecell_hzz.indexOf("editOrder") != -1){
										tpk_timecell_hzz = pk_timecell_hzz.substring(0,22);
										wpk_timecell_hzz = pk_timecell_hzz.substring(34,pk_timecell_hzz.length);
									} else {
										tpk_timecell_hzz = pk_timecell_hzz.substring(0,24);
										wpk_timecell_hzz = pk_timecell_hzz.substring(36,pk_timecell_hzz.length);
									}
									pk_timecell_hzz = tpk_timecell_hzz + wpk_timecell_hzz;
									pk_timecell_hzz = pk_timecell_hzz.replace("&","%26");
									pk_timecell_hzz = pk_timecell_hzz.replace("&","%26");
									pk_timecell_hzz = pk_timecell_hzz.replace("&","%26");
									pk_timecell_hzz = pk_timecell_hzz.replace("=","%3D");
									pk_timecell_hzz = pk_timecell_hzz.replace("=","%3D");
									pk_timecell_hzz = pk_timecell_hzz.replace("=","%3D");
								}
								formStr += "pk_timecell_h="+pk_timecell_hzz+"&";
								var shjhnumzz = $(inputobj[0]).val();
								formStr += "shjhnum="+shjhnumzz+"&";
								var vehicle_tszz = $(inputobj[11]).val();
								formStr += "vehicle_ts="+vehicle_tszz+"&";
							}
						});
						$.ajax( {
							url : "/ebvp/schedulecoll/paichengconller/paichengfomcitj",
							type : "POST",
							//data : formStr, 
							data:formStr,//$("#fomcitj").serialize(), 
							dataType : "text",
							async : false,
							success : djiwowRespondjiwn
						});
						function djiwowRespondjiwn(responseText, statusText, xhr, $form){
							var qbconcg = getLanMsg("0ec22420-000244");
							alert(qbconcg);
							if(diogei == 1){
								var wulflvalue = $("#pk_marbasclass").val();
								$("#wulflvalueai").val(wulflvalue);
	//						var newwulflvalue = wulflvalue.split(",");
								var wulflvaluename = $("#qrygoodsClass").val();
								$("#wulflvalueainame").val(wulflvaluename);
							}
								$("#fomcitj").attr("action","/ebvp/schedulecoll/paichengconller/paichengfomcitjzz");
								$("#fomcitj").submit();
							
						}
//						if(1==1){
//							alert("fsdfsdfdsfsa");
////							return false;
//						}
						if(cltcdol == 0){
							if(diogei == 1){
								var wulflvalue = $("#pk_marbasclass").val();
								$("#wulflvalueai").val(wulflvalue);
	//						var newwulflvalue = wulflvalue.split(",");
								var wulflvaluename = $("#qrygoodsClass").val();
								$("#wulflvalueainame").val(wulflvaluename);
							}
							$("#fomcitj").attr("action","/ebvp/schedulecoll/paichengconller/paichengfomcitjzz");
					    	$("#fomcitj").submit();
				    	}
						return false;
					},
					cancel : function(){
					}
			};
			showConfirmDialogsch(option);
						
				}
				
				
				
				//return false;
			} else{
				var formStr = "";
				var pk_org_cgstszz = $("#pk_org_cgsts").val();
				formStr += "pk_org_cgsts="+pk_org_cgstszz+"&";
				var sysinitnumzz = $("#sysinitnum").val();
				formStr += "sysinitnum="+sysinitnumzz+"&";
				var iscgnumzz = $("#iscgnum").val();
				formStr += "iscgnum="+iscgnumzz+"&";
				var dqdatezz = $("#dqdate").val();
				formStr += "dqdate="+dqdatezz+"&";
				var purscherule_pkzz = $("#purscherule_pk").val();
				formStr += "purscherule_pk="+purscherule_pkzz+"&";
				var bijpkorgzz = $("#bijpkorg").val();
				formStr += "pk_org_cgs="+bijpkorgzz+"&";
				
				$("label[id=abs]").each(function(index, obj){
					var inputobj = $(obj).find("input");
					var pk_timecell_hzs = $(inputobj[1]).val();
					var iscommitax = $(inputobj[6]).val();
					var shjhnumzxind = $(inputobj[0]).val();
					var displeyvalue = $(obj).parents(".data_amount_row").css("display");
					if("block" == displeyvalue && shjhnumzxind != "" && shjhnumzxind != null && pk_timecell_hzs != null && pk_timecell_hzs.length > 1 && iscommitax == 'false'){
						var srcxinxzz = $(inputobj[13]).val();
						formStr += "srcxinx="+srcxinxzz+"&";
						var isconfirmzz = $(inputobj[2]).val();
//						formStr += "isconfirm="+isconfirmzz+"&";
						var iscommitzz = $(inputobj[6]).val();
//						formStr += "iscommit="+iscommitzz+"&";
						var pk_timecell_hzz = $(inputobj[1]).val();
						if(pk_timecell_hzz != null){
//							var tpk_timecell_hzz = pk_timecell_hzz.substring(0,22);
//							var wpk_timecell_hzz = pk_timecell_hzz.substring(34,pk_timecell_hzz.length);
							var tpk_timecell_hzz = "";
							var wpk_timecell_hzz = "";
							if (pk_timecell_hzz.indexOf("editOrder") != -1){
								tpk_timecell_hzz = pk_timecell_hzz.substring(0,22);
								wpk_timecell_hzz = pk_timecell_hzz.substring(34,pk_timecell_hzz.length);
							} else {
								tpk_timecell_hzz = pk_timecell_hzz.substring(0,24);
								wpk_timecell_hzz = pk_timecell_hzz.substring(36,pk_timecell_hzz.length);
							}
							pk_timecell_hzz = tpk_timecell_hzz + wpk_timecell_hzz;
							pk_timecell_hzz = pk_timecell_hzz.replace("&","%26");
							pk_timecell_hzz = pk_timecell_hzz.replace("&","%26");
							pk_timecell_hzz = pk_timecell_hzz.replace("&","%26");
							pk_timecell_hzz = pk_timecell_hzz.replace("=","%3D");
							pk_timecell_hzz = pk_timecell_hzz.replace("=","%3D");
							pk_timecell_hzz = pk_timecell_hzz.replace("=","%3D");
						}
						formStr += "pk_timecell_h="+pk_timecell_hzz+"&";
						var shjhnumzz = $(inputobj[0]).val();
						formStr += "shjhnum="+shjhnumzz+"&";
						var vehicle_tszz = $(inputobj[11]).val();
						formStr += "vehicle_ts="+vehicle_tszz+"&";
					}
				});
				$.ajax( {
					url : "/ebvp/schedulecoll/paichengconller/paichengfomcitj",
					type : "POST",
					//data : formStr, 
					data:formStr,//$("#fomcitj").serialize(), 
					dataType : "text",
					async : false,
					success : function(msg) {
						if(msg != null){
							var qbconcg = getLanMsg("0ec22420-000244");
							var qbconcgts = getLanMsg("0ec22420-000175");
							var option = {
									title : qbconcgts,
									content : qbconcg,
									confirm : function() {
								if(diogei == 1){
									var wulflvalue = $("#pk_marbasclass").val();
									$("#wulflvalueai").val(wulflvalue);
				//				var newwulflvalue = wulflvalue.split(",");
									var wulflvaluename = $("#qrygoodsClass").val();
									$("#wulflvalueainame").val(wulflvaluename);
								}
									$("#fomcitj").attr("action","/ebvp/schedulecoll/paichengconller/paichengfomcitjzz");
									$("#fomcitj").submit();
								},
								cancel : function(){
									alert("fsfd");
								}    
							};
							showConfirmDialogsch(option);
						}
					}
				});
//				function showRespdiwn(responseText, statusText, xhr, $form){
//				}
//				if(1==1){
//					alert("fsdfsdfdsfsa");
////					return false;
//				}
				if(cltcdol == 0){
					if(diogei == 1){
						var wulflvalue = $("#pk_marbasclass").val();
						$("#wulflvalueai").val(wulflvalue);
	//				var newwulflvalue = wulflvalue.split(",");
						var wulflvaluename = $("#qrygoodsClass").val();
						$("#wulflvalueainame").val(wulflvaluename);
					}
					$("#fomcitj").attr("action","/ebvp/schedulecoll/paichengconller/paichengfomcitjzz");
			    	$("#fomcitj").submit();
		    	}
				return false;
			}
			
	});
	$("#btn_grayqbdc").click(function() {
		if(1!=1){
			showCfmMsg("提示","导出按钮已加，功能还未完全实现请等待下张盘试试嘿嘿！~！~！~！~！");
			return false;
		} else {
			if(diogei == 1){
				var wulflvalue = $("#pk_marbasclass").val();
				$("#wulflvalueai").val(wulflvalue);
//			var newwulflvalue = wulflvalue.split(",");
				var wulflvaluename = $("#qrygoodsClass").val();
				$("#wulflvalueainame").val(wulflvaluename);
			}
			$("#fomcitj").attr("action","/ebvp/schedulecoll/paichengconller/paichengqrypaichengdac");
			$("#fomcitj").submit();
			return false;
		}
	});
	$("#btn_grayqbtj").click(function() {
		if(fig==1){
			var intfig = 1;
			var shifcsum = 0;
			var shulyanz = 0;
			var sysinitnum = $("#sysinitnum").val();
			var listdcd = $("#listdcd").val();
			var listil = 0;
			var listils = 0;
			var pdsi = 0;
			var finmie = 0;
			var wuprod5 = "";
			var newwuprod5 ="";
			var srcckju = "1";
			for ( var rowsLoogp = 0; rowsLoogp < new Number(listdcd); rowsLoogp++) {
				var isfiqrne = 0;
				var isfitjine = 0;
				var jisq = 0;
				//var obj = $("body").find("[resid='" + rowsLoogp + "']");
				$("input[residfuck=resid"+rowsLoogp+"]").each(function(index, obj){
					srcckju = $(obj).parent().find("input:eq(13)").val();//gdw数量
					var jsscheilpecheng = $(obj).parent().find("input:eq(1)").val();
					var shjhnumsavalue = $(obj).val();
					var displeyvalue = $(obj).parents(".data_amount_row").css("display");
					if("block" == displeyvalue && shjhnumsavalue != null){
						var iscommitvalue = $(obj).parent().find("input:eq(6)").val();
						if(iscommitvalue == 'false'){
							finmie = finmie+1;
							var isconfirmvalue = $(obj).parent().find("input:eq(2)").val();
							if(isconfirmvalue == 'true'){
								isfitjine = isfitjine +1;
								jisq = jisq +1;
								if(pdsi == 0){
									pdsi =1;
								}
							} else {
								isfiqrne = isfiqrne +1;
								jisq = jisq +1;
							}
						} else {
							if(pdsi == 0){
								pdsi =0;
							}
						}
						if(iscommitvalue == 'false'){
							var isconfirmvalue = $(obj).parent().find("input:eq(2)").val();
							if(isconfirmvalue == 'true'){
								var shjhnum = $(obj).parent().find("input:eq(0)").val();
					        	var jisuanshjhnum = $(obj).parent().find("input:eq(12)").val();
					        	var jisuanrcvalue = sysinitnum;
					        	if(shjhnum != null && shjhnum != ""){
						        	var newjisuanshjhnuma = new Number(jisuanshjhnum) + new Number(jisuanshjhnum) * (jisuanrcvalue/100);
						        	if(new Number(shjhnum) > new Number(newjisuanshjhnuma)){
						        		if(1==1||srcckju != "2"){
						        			shifcsum = shifcsum+1;
						        			wuprod5 = $(obj).parent().find("input:eq(15)").val();//gdw数量
							        		if(newwuprod5 == ""){
							        			newwuprod5 += wuprod5;
											} else {
												var valuesy = newwuprod5.split(",");
												var jisqa = 0;
												for ( var rowsLoogp = 0; rowsLoogp < valuesy.length; rowsLoogp++) {
													if(valuesy[rowsLoogp] == wuprod5){
														jisqa = 1;
													}
												}
												if(jisqa == 0){
													newwuprod5 += ","+wuprod5;
												}
											}
						        		}
						        	}
					        	}
					        	if(shjhnum != null && shjhnum != ""){
					        		if("undefined" == typeof(shjhnum) || new Number(shjhnum) < 0){
					        		//if(new Number(shjhnum) < 0){
					        			var msg1 = getLanMsg("0ec22420-000168");
					        			var mwjnwq = getLanMsg("0ec22420-000175");
					            		showCfmMsg(mwjnwq,msg1);
					            		shulyanz = shulyanz+1;
					        		}
					        	}
					        	if("undefined" == typeof(shjhnum) || "" == shjhnum){
					        		var msg1 = getLanMsg("0ec22420-000168");
					        		var uwnejhd = getLanMsg("0ec22420-000175");
					        		showCfmMsg(uwnejhd,msg1);
				            		shulyanz = shulyanz+1;
					        	}
							}
						}
					} 
				});
				if(jisq != 0){
					if(jisq == isfiqrne || jisq == isfitjine){
						if(intfig != 0){
							intfig = 1;
						}
					} else {
						if(listil == 0){
							listil = rowsLoogp+1;
						}
						if(listils == 0){
							listils += rowsLoogp+1;
						} else {
							listils += ","+(rowsLoogp+1);
						}
						intfig = 0;
					}
				}
			}
			if(finmie != 0 && intfig == 0){
				var msg1 = getLanMsg("0ec22420-000235");
				var msg2 = getLanMsg("0ec22420-000236");
				var vbhdyw = getLanMsg("0ec22420-000175");
				showCfmMsg(vbhdyw,msg1+listils+msg2);
				return false;
			}
			if(pdsi == 0){
				var msg1 = getLanMsg("0ec22420-000174");
				var yhnwjq = getLanMsg("0ec22420-000175");
				showCfmMsg(yhnwjq,msg1);
				return false;
			}
			var iscgnum = $("#iscgnum").val();
			if(iscgnum == "false"){
				if(shifcsum != 0){
//					if(srcckju != "2"){
						if(sysinitnum == 0){
							var msg2 = getLanMsg("0ec22420-000233");
							var iunejk = getLanMsg("0ec22420-000175");
							showCfmMsg(iunejk,newwuprod5+msg2);
						} else {
							var msg2 = getLanMsg("0ec22420-000169");
							var olmkiq = getLanMsg("0ec22420-000175");
							showCfmMsg(olmkiq,newwuprod5+msg2+ sysinitnum +"%");
						}
						return false;
//					}
				}
			}
			if(shulyanz != 0){
				var msg2 = getLanMsg("0ec22420-000171");
				var ioqinj = getLanMsg("0ec22420-000175");
				showCfmMsg(ioqinj,msg2);
				return false;
			}
			$("input[residcommt=residcommt]").each(function(index, obj){
				var shjhnumsavalue = $(obj).val();
				if(shjhnumsavalue != null){
					var iscommitvalue = $(obj).parent().find("input:eq(2)").val();
					if(iscommitvalue == 'false'){
						var rewvalue = $("#residcommtinpu").val()
						if("2" != rewvalue){
							$("#residcommtinpu").val("2");
						}
					} else if(iscommitvalue == 'true'){
						var displeyvalue = $(obj).parents(".data_amount_row").css("display");
						if("none" == displeyvalue){
							var rewvalue = $("#residcommtinpu").val();
							if("2" != rewvalue){
								$("#residcommtinpu").val("2");
							}
						}
					}
				}
			});
			var formStr = "";
			var residcommtinpuvalu = $("#residcommtinpu").val();
			formStr += "residcommtinpu="+residcommtinpuvalu+"&";
			
			var pk_org_cgstszz = $("#pk_org_cgsts").val();
			formStr += "pk_org_cgsts="+pk_org_cgstszz+"&";
			
			var sysinitnumzz = $("#sysinitnum").val();
			formStr += "sysinitnum="+sysinitnumzz+"&";
			var iscgnumzz = $("#iscgnum").val();
			formStr += "iscgnum="+iscgnumzz+"&";
			var dqdatezz = $("#dqdate").val();
			formStr += "dqdate="+dqdatezz+"&";
			var purscherule_pkzz = $("#purscherule_pk").val();
			formStr += "purscherule_pk="+purscherule_pkzz+"&";
			var bijpkorgzz = $("#bijpkorg").val();
			formStr += "pk_org_cgs="+bijpkorgzz+"&";
			$("label[id=abs]").each(function(index, obj){
				var inputobj = $(obj).find("input");
				var pk_timecell_hzs = $(inputobj[1]).val();
				var iscommitax = $(inputobj[6]).val();
				var isconfirmax = $(inputobj[2]).val();
				var issealvalue = $(inputobj[16]).val();
				var fiek = 0;
				var idAmounts = trim($(obj).parent().parent().attr("class")).split(" ");
				for ( var rowsLoogpa = 0; rowsLoogpa < idAmounts.length; rowsLoogpa++) {
					var idameit = idAmounts[rowsLoogpa];
					idameit = trim(idameit);
					if(idameit == "idAmountEditablesn"){
						fiek = 1;
					}
				}
				var displeyvalue = $(obj).parents(".data_amount_row").css("display");
				if("block" == displeyvalue && fiek == 0 && pk_timecell_hzs != null && pk_timecell_hzs.length > 1 && iscommitax == 'false' && isconfirmax == 'true' && issealvalue == 'false'){
					var srcxinxzz = $(inputobj[13]).val();
					formStr += "srcxinx="+srcxinxzz+"&";
					var isconfirmzz = $(inputobj[2]).val();
//					formStr += "isconfirm="+isconfirmzz+"&";
					var iscommitzz = $(inputobj[6]).val();
//					formStr += "iscommit="+iscommitzz+"&";
					var pk_timecell_hzz = $(inputobj[1]).val();
					if(pk_timecell_hzz != null){
//						var tpk_timecell_hzz = pk_timecell_hzz.substring(0,22);
//						var wpk_timecell_hzz = pk_timecell_hzz.substring(34,pk_timecell_hzz.length);
						var tpk_timecell_hzz = "";
						var wpk_timecell_hzz = "";
						if (pk_timecell_hzz.indexOf("editOrder") != -1){
							tpk_timecell_hzz = pk_timecell_hzz.substring(0,22);
							wpk_timecell_hzz = pk_timecell_hzz.substring(34,pk_timecell_hzz.length);
						} else {
							tpk_timecell_hzz = pk_timecell_hzz.substring(0,24);
							wpk_timecell_hzz = pk_timecell_hzz.substring(36,pk_timecell_hzz.length);
						}
						pk_timecell_hzz = tpk_timecell_hzz + wpk_timecell_hzz;
						pk_timecell_hzz = pk_timecell_hzz.replace("&","%26");
						pk_timecell_hzz = pk_timecell_hzz.replace("&","%26");
						pk_timecell_hzz = pk_timecell_hzz.replace("&","%26");
						pk_timecell_hzz = pk_timecell_hzz.replace("=","%3D");
						pk_timecell_hzz = pk_timecell_hzz.replace("=","%3D");
						pk_timecell_hzz = pk_timecell_hzz.replace("=","%3D");
					}
					formStr += "pk_timecell_h="+pk_timecell_hzz+"&";
					var shjhnumzz = $(inputobj[0]).val();
					formStr += "shjhnum="+shjhnumzz+"&";
					var vehicle_tszz = $(inputobj[11]).val();
					formStr += "vehicle_ts="+vehicle_tszz+"&";
				}
			});
			$.ajax( {
				url : "/ebvp/schedulecoll/paichengconller/paichengfomcicommit",
				type : "POST",
				data:formStr,
				dataType : "text",
				async : false,
				success:function(msg) {
					if(msg != null){
						var tjconcg = getLanMsg("0ec22420-000243");
						var tjconcgts = getLanMsg("0ec22420-000175");
						var option = {
								title : tjconcgts,
								content : tjconcg,
								confirm : function() {
							if(diogei == 1){
								var wulflvalue = $("#pk_marbasclass").val();
								$("#wulflvalueai").val(wulflvalue);
				//			var newwulflvalue = wulflvalue.split(",");
								var wulflvaluename = $("#qrygoodsClass").val();
								$("#wulflvalueainame").val(wulflvaluename);
							}
								$("#fomcitj").attr("action","/ebvp/schedulecoll/paichengconller/paichengfomcicommitzz");
								$("#fomcitj").submit();
							},
							cancel : function(){
								alert("fsfd");
							}
						};
						showConfirmDialogsch(option);
					}
				}
			});
//			function showResponsefdsal(responseText, statusText, xhr, $form){
//			}
//			if(1==1){
//				alert("fdsfds");
//				return false;
//			}
			if(cltcdol == 0){
				if(diogei == 1){
					var wulflvalue = $("#pk_marbasclass").val();
					$("#wulflvalueai").val(wulflvalue);
	//			var newwulflvalue = wulflvalue.split(",");
					var wulflvaluename = $("#qrygoodsClass").val();
					$("#wulflvalueainame").val(wulflvaluename);
				}
				$("#fomcitj").attr("action","/ebvp/schedulecoll/paichengconller/paichengfomcicommitzz");
				$("#fomcitj").submit();
			}
			return false;
		} else {
			var intfig = 0;
			var shifcsum = 0;
			var shulyanz = 0;
			var sysinitnum = $("#sysinitnum").val();
			$("input[name=iscommit]").each(function(index, obj){
				var iscommitvalue = $(obj).val();
				if(iscommitvalue == 'false'){
					var isconfirmvalue = $(obj).parent().find("input:eq(2)").val();
					if(isconfirmvalue == 'true'){
						intfig = intfig+1;
					}
				}
				if(iscommitvalue == 'false'){
					var isconfirmvalue = $(obj).parent().find("input:eq(2)").val();
					if(isconfirmvalue == 'true'){
						var shjhnum = $(obj).parent().find("input:eq(0)").val();
			        	var jisuanshjhnum = $(obj).parent().find("input:eq(12)").val();
			        	var jisuanrcvalue = sysinitnum;
			        	if(shjhnum != null && shjhnum != ""){
				        	var newjisuanshjhnuma = new Number(jisuanshjhnum) + new Number(jisuanshjhnum) * (jisuanrcvalue/100);
				        	if(new Number(shjhnum) > new Number(newjisuanshjhnuma)){
				        		shifcsum = shifcsum+1;
				        	}
			        	}
			        	if(shjhnum != null && shjhnum != ""){
			        		if("undefined" == typeof(shjhnum) || new Number(shjhnum) < 0){
			        		//if(new Number(shjhnum) < 0){
			        			var msg2 = getLanMsg("0ec22420-000168");
			        			var ajiwn = getLanMsg("0ec22420-000175");
			            		showCfmMsg(ajiwn,msg2);
			            		shulyanz = shulyanz+1;
			        		}
			        	}
			        	if("undefined" == typeof(shjhnum) || "" == shjhnum){
			        		var msg2 = getLanMsg("0ec22420-000168");
			        		var inkjwqn = getLanMsg("0ec22420-000175");
			        		showCfmMsg(inkjwqn,msg2);
		            		shulyanz = shulyanz+1;
			        	}
					}
				}
			});
			if(intfig == 0){
				var msg1 = getLanMsg("0ec22420-000174");
				var mnbvg = getLanMsg("0ec22420-000175");
				showCfmMsg(mnbvg,msg1);
				return false;
			}
			var iscgnum = $("#iscgnum").val();
			if(iscgnum == "false"){
				if(shifcsum != 0){
					if(sysinitnum == 0){
						var msg2 = getLanMsg("0ec22420-000233");
						var qcvgh = getLanMsg("0ec22420-000175");
						showCfmMsg(qcvgh,msg2);
					} else {
						var msg2 = getLanMsg("0ec22420-000169");
						var iuenj = getLanMsg("0ec22420-000175");
						showCfmMsg(iuenj,msg2+ sysinitnum +"%");
					}
					return false;
				}
			}
			if(shulyanz != 0){
				var msg2 = getLanMsg("0ec22420-000171");
				var mqwkiwn = getLanMsg("0ec22420-000175");
				showCfmMsg(mqwkiwn,msg2);
				return false;
			}//
			var formStr = "";
			var pk_org_cgstszz = $("#pk_org_cgsts").val();
			formStr += "pk_org_cgsts="+pk_org_cgstszz+"&";
			var sysinitnumzz = $("#sysinitnum").val();
			formStr += "sysinitnum="+sysinitnumzz+"&";
			var iscgnumzz = $("#iscgnum").val();
			formStr += "iscgnum="+iscgnumzz+"&";
			var dqdatezz = $("#dqdate").val();
			formStr += "dqdate="+dqdatezz+"&";
			var purscherule_pkzz = $("#purscherule_pk").val();
			formStr += "purscherule_pk="+purscherule_pkzz+"&";
			var bijpkorgzz = $("#bijpkorg").val();
			formStr += "pk_org_cgs="+bijpkorgzz+"&";
			$("label[id=abs]").each(function(index, obj){
				var inputobj = $(obj).find("input");
				var pk_timecell_hzs = $(inputobj[1]).val();
				var iscommitax = $(inputobj[6]).val();
				var isconfirmax = $(inputobj[2]).val();
				if(pk_timecell_hzs != null && pk_timecell_hzs.length > 1 && iscommitax == 'false' && isconfirmax == 'true'){
					var srcxinxzz = $(inputobj[13]).val();
					formStr += "srcxinx="+srcxinxzz+"&";
					var isconfirmzz = $(inputobj[2]).val();
//					formStr += "isconfirm="+isconfirmzz+"&";
					var iscommitzz = $(inputobj[6]).val();
//					formStr += "iscommit="+iscommitzz+"&";
					var pk_timecell_hzz = $(inputobj[1]).val();
					if(pk_timecell_hzz != null){
//						var tpk_timecell_hzz = pk_timecell_hzz.substring(0,22);
//						var wpk_timecell_hzz = pk_timecell_hzz.substring(34,pk_timecell_hzz.length);
						var tpk_timecell_hzz = "";
						var wpk_timecell_hzz = "";
						if (pk_timecell_hzz.indexOf("editOrder") != -1){
							tpk_timecell_hzz = pk_timecell_hzz.substring(0,22);
							wpk_timecell_hzz = pk_timecell_hzz.substring(34,pk_timecell_hzz.length);
						} else {
							tpk_timecell_hzz = pk_timecell_hzz.substring(0,24);
							wpk_timecell_hzz = pk_timecell_hzz.substring(36,pk_timecell_hzz.length);
						}
						pk_timecell_hzz = tpk_timecell_hzz + wpk_timecell_hzz;
						pk_timecell_hzz = pk_timecell_hzz.replace("&","%26");
						pk_timecell_hzz = pk_timecell_hzz.replace("&","%26");
						pk_timecell_hzz = pk_timecell_hzz.replace("&","%26");
						pk_timecell_hzz = pk_timecell_hzz.replace("=","%3D");
						pk_timecell_hzz = pk_timecell_hzz.replace("=","%3D");
						pk_timecell_hzz = pk_timecell_hzz.replace("=","%3D");
					}
					formStr += "pk_timecell_h="+pk_timecell_hzz+"&";
					var shjhnumzz = $(inputobj[0]).val();
					formStr += "shjhnum="+shjhnumzz+"&";
					var vehicle_tszz = $(inputobj[11]).val();
					formStr += "vehicle_ts="+vehicle_tszz+"&";
				}
			});
			$.ajax( {
				url : "/ebvp/schedulecoll/paichengconller/paichengfomcicommit",
				type : "POST",
				data:formStr,
				dataType : "text",
				async : false,
				success : showResponsebc
			});
			function showResponsebc(responseText, statusText, xhr, $form){
			}
			$("#fomcitj").attr("action","/ebvp/schedulecoll/paichengconller/paichengfomcicommitzz");
			$("#fomcitj").submit();
			return false;
		
		}
	});
	var figne = false;
	$("#flip_leftnext").click(function() {
		if(figne){
			showCfmMsg("提示","上一步按钮已加，功能还未完全实现请等待下张盘试试嘿嘿！~！~！~！~！");
			return false;
		} else {
			var onedatevalue = $("#timefirid").val();
			var datevalue = $("#dqdate").val();
			if(datevalue.replace(/-/g,"") < onedatevalue.replace(/-/g,"")){
				var msg312 = getLanMsg("0ec22420-000133");
				var msg3ee2 = getLanMsg("0ec22420-000175");
				showCfmMsg(msg3ee2,msg312);
				return false;
			}
			if(onedatevalue != null && onedatevalue != ""){
				$("#onedate").val(onedatevalue);
			}
			$("#fomcitj").attr("action","/ebvp/schedulecoll/paichengconller/paichengqrypaichengsnext");
			$("#fomcitj").submit();
			return false;
		}
	});
	$("#flip_rightnext").click(function() {
		if(figne){
			showCfmMsg("提示","下一步按钮已加，功能还未完全实现请等待下张盘试试嘿嘿！~！~！~！~！");
			return false;
		} else {
			var onedatevalue = $("#onedate").val();
			var datevalue = $("#dqdate").val();
			if(datevalue.replace(/-/g,"") < onedatevalue.replace(/-/g,"")){
				var msg312 = getLanMsg("0ec22420-000133");
				var mee2 = getLanMsg("0ec22420-000175");
				showCfmMsg(mee2,msg312);
				return false;
			}
			var onedatevalue = $("#timefirid").val();
			if(onedatevalue != null && onedatevalue != ""){
				$("#onedate").val(onedatevalue);
			}
			$("#fomcitj").attr("action","/ebvp/schedulecoll/paichengconller/paichengqrypaichengnext");
			$("#fomcitj").submit();
			return false;
		}
	});
	$("#fanhui").click(function() {
		if(figne){
			showCfmMsg("提示","返回按钮已加，功能还未完全实现请等待下张盘试试嘿嘿！~！~！~！~！");
			return false;
		} else {
			$("#fomcitj").attr("action","/ebvp/schedulecoll/paichengconller/paichengschedulecoll");
			$("#fomcitj").submit();
			return false;
		}
	});
	$("#chaxa").click(function() {
		if(figne){
			showCfmMsg("提示","查询按钮已加，功能还未完全实现请等待下张盘试试嘿嘿！~！~！~！~！");
			return false;
		} else {
			var onedatevalue = $("#timefirid").val();
			var datevalue = $("#dqdate").val();
			if(datevalue.replace(/-/g,"") < onedatevalue.replace(/-/g,"")){
				var msg312 = getLanMsg("0ec22420-000133");
				var msolp = getLanMsg("0ec22420-000175");
				showCfmMsg(msolp,msg312);
				return false;
			}
			if(onedatevalue == null||onedatevalue == ""){
				var juqnig = getLanMsg("0ec22420-000175");
				showCfmMsg(juqnig,"请输入查询的时间");
				return false;
			}
			$("#onedate").val(onedatevalue);
			$("#fomcitj").attr("action","/ebvp/schedulecoll/paichengconller/paichengqrypaicheng");
			$("#fomcitj").submit();
			return false;
		}
	});
	$("#wulfenleicha").click(function() {
		if(figne){
			showCfmMsg("提示","下一步按钮已加，功能还未完全实现请等待下张盘试试嘿嘿！~！~！~！~！");
			return false;
		} else {
//			var wulflvalue = $("#wulfl").val();
			var wulflvalue = $("#pk_marbasclass").val();
			var newwulflvalue = wulflvalue.split(",");
			if(newwulflvalue.length == 1 && newwulflvalue[0] == ""){
				$(".data_amount_row").show();
				var datearowlength = $(".data_amount_row").length;
				var jishuqiwl = 0;
				for ( var rowsLoogp = 0; rowsLoogp < datearowlength; rowsLoogp++) {
					var wulnemavalue = $(".data_amount_row")[rowsLoogp];
					var stylevalue = $(wulnemavalue).attr("style");
					var displeyvalue = $(wulnemavalue).css("display");
					if("block" == displeyvalue){
						jishuqiwl ++;
					}
				}
				$(".color_f30000").text(jishuqiwl);
			} else {
				$(".data_amount_row").show();
				for ( var rowsLoogp = 0; rowsLoogp < newwulflvalue.length; rowsLoogp++) {
					var wulnemavalue = newwulflvalue[rowsLoogp];
//					$("#"+wulnemavalue).hide();
					var obj = $("body").find("[idfl='"+wulnemavalue+"']");
					obj.hide();
				}
				var datearowlength = $(".data_amount_row").length;
				var jishuqiwl = 0;
				for ( var rowsLoogp = 0; rowsLoogp < datearowlength; rowsLoogp++) {
					var wulnemavalue = $(".data_amount_row")[rowsLoogp];
					var stylevalue = $(wulnemavalue).attr("style");
					var displeyvalue = $(wulnemavalue).css("display");
					if("block" == displeyvalue){
						jishuqiwl ++;
					}
				}
				$(".color_f30000").text(jishuqiwl);
			}
		}
	});
	function pkpubclassa(){
		var wulflvalue = $("#pk_marbasclass").val();
		var newwulflvalue = wulflvalue.split(",");
		if(newwulflvalue.length == 1 && newwulflvalue[0] == ""){
			$(".data_amount_row").show();
			var datearowlength = $(".data_amount_row").length;
			var jishuqiwl = 0;
			for ( var rowsLoogp = 0; rowsLoogp < datearowlength; rowsLoogp++) {
				var wulnemavalue = $(".data_amount_row")[rowsLoogp];
				var stylevalue = $(wulnemavalue).attr("style");
				var displeyvalue = $(wulnemavalue).css("display");
				if("block" == displeyvalue){
					jishuqiwl ++;
				}
			}
			$(".color_f30000").text(jishuqiwl);
		} else {
			$(".data_amount_row").show();
			for ( var rowsLoogp = 0; rowsLoogp < newwulflvalue.length; rowsLoogp++) {
				var wulnemavalue = newwulflvalue[rowsLoogp];
				var obj = $("body").find("[idfl='"+wulnemavalue+"']");
				obj.hide();
			}
			var datearowlength = $(".data_amount_row").length;
			var jishuqiwl = 0;
			for ( var rowsLoogp = 0; rowsLoogp < datearowlength; rowsLoogp++) {
				var wulnemavalue = $(".data_amount_row")[rowsLoogp];
				var stylevalue = $(wulnemavalue).attr("style");
				var displeyvalue = $(wulnemavalue).css("display");
				if("block" == displeyvalue){
					jishuqiwl ++;
				}
			}
			$(".color_f30000").text(jishuqiwl);
		}
	}
	
	function pkpubclassje(){
		var shjhnumnumScale = 2;
		var listdcd = $("#listdcd").val();
		for ( var rowsLoogp = 0; rowsLoogp < new Number(listdcd); rowsLoogp++) {
			var resjevlzio = null;
			$("li[resjeid=resid"+rowsLoogp+"]").each(function(index, obj){
				var displeyvalue = $(obj).parents(".data_amount_row").css("display");
				var resjevllue = $(obj).attr("resjevl");
				var resjevlenglue = $(obj).attr("resjevleng");
				if("block" == displeyvalue && resjevllue != null &&　resjevllue　!= ""){
					if(resjevlzio == null){
						resjevlzio = 0
					}
					resjevlzio = new Number(resjevllue) + new Number(resjevlzio);
					if(resjevlenglue != null && ""!=resjevlenglue){
						shjhnumnumScale = resjevlenglue;
					}
				}
			});
			$("span[resjebdid=resid"+rowsLoogp+"]").text(subReduNum(resjevlzio+"",shjhnumnumScale));
		}
	}
	
	$("a[name='btn_anltj']").click(function() {
		var btnanacion = $(this);
		if(fig==1){
			var intfig = 0;
			var shifcsum = 0;
			var shulyanz = 0;
			var sysinitnum = $("#sysinitnum").val();
			var rowsLoogpleng = btnanacion.attr("btnnamelist");
			var rowsLoogp = new Number(rowsLoogpleng);//rowsLoogpleng.substring(rowsLoogpleng.length-1,rowsLoogpleng.length);
			var prodwul6 = "";
			var newprodwul6 ="";
			var srclkwi = "1";
			$("input[residfuck=resid"+rowsLoogp+"]").each(function(index, obj){	
				var shjhnumsavalue = $(obj).val();
				srclkwi = $(obj).parent().find("input:eq(13)").val();
				
				var displeyvalue = $(obj).parents(".data_amount_row").css("display");
				if(shjhnumsavalue != null && "block" == displeyvalue){
					var iscommitvalue = $(obj).parent().find("input:eq(6)").val();
					var jisuanvalue = $(obj).parent().find("input:eq(0)").val();
					var nextobj = $(obj).parent().parent().parent().find("span").last().prev();
					var nextvoaue = nextobj.text();
					if(nextvoaue != null && nextvoaue !="" && jisuanvalue != null && jisuanvalue!= "" && iscommitvalue == 'false'){
						intfig = intfig+1;
					}
					if(iscommitvalue == 'false'){
						var shjhnum = $(obj).parent().find("input:eq(0)").val();
			        	var jisuanshjhnum = $(obj).parent().find("input:eq(12)").val();
			        	var jisuanrcvalue = sysinitnum;
			        	if(shjhnum != null && shjhnum != ""){
				        	var newjisuanshjhnuma = new Number(jisuanshjhnum) + new Number(jisuanshjhnum) * (jisuanrcvalue/100);
				        	if(new Number(shjhnum) > new Number(newjisuanshjhnuma)){
				        		if(1==1||srclkwi != "2"){
					        		shifcsum = shifcsum+1;
					        		prodwul6 = $(obj).parent().find("input:eq(15)").val();
					        		if(newprodwul6 == ""){
					        			newprodwul6 += prodwul6;
									} else {
		//								newprodwul6 += ","+prodwul6;
										var valuesy = newprodwul6.split(",");
										var jisqaf = 0;
										for ( var rowsLoogp = 0; rowsLoogp < valuesy.length; rowsLoogp++) {
											if(valuesy[rowsLoogp] == prodwul6){
												jisqaf = 1;
											}
										}
										if(jisqaf == 0){
											newprodwul6 += ","+prodwul6;
										}
									}
				        		}
				        	}
			        	}
			        	if(shjhnum != null && shjhnum != ""){
			        		if("undefined" == typeof(shjhnum) || new Number(shjhnum) < 0){
			        		//if(new Number(shjhnum) < 0){
			        			var msg2 = getLanMsg("0ec22420-000234");
			        			var qgbjuw = getLanMsg("0ec22420-000175");
			            		showCfmMsg(qgbjuw,msg2);
			            		shulyanz = shulyanz+1;
			        		}
			        	}
			        	if("undefined" == typeof(shjhnum) || "" == shjhnum){
			        		//showCfmMsg("提示","送货计划数量需大于等于0，请修改送货计划数量2！");
		            		shulyanz = shulyanz+1;
			        	}
					}
				}
			});
			if(intfig == 0){
				if(shulyanz != 0){
					var msg2 = getLanMsg("0ec22420-000234");
					var mldwji = getLanMsg("0ec22420-000175");
					showCfmMsg(mldwji,msg2);
					return false;
				}
				var msg2 = getLanMsg("0ec22420-000173");
				var nfjwin = getLanMsg("0ec22420-000175");
				showCfmMsg(nfjwin,msg2);
				return false;
			}
			var iscgnum = $("#iscgnum").val();
			if(iscgnum == "false"){
				if(shifcsum != 0){
//					if(srclkwi != "2"){
						if(sysinitnum == 0){
							var msg2 = getLanMsg("0ec22420-000233");
							var rgewava = getLanMsg("0ec22420-000175");
							showCfmMsg(rgewava,newprodwul6 + msg2);
						} else {
							var msg2 = getLanMsg("0ec22420-000169");
							var jtrf = getLanMsg("0ec22420-000175");
							showCfmMsg(jtrf,newprodwul6 + msg2+ sysinitnum +"%");
						}
						return false;
//					}
				}
			}
			if(shulyanz != 0){
				if(cltcdol == 0){
					var msg2 = getLanMsg("0ec22420-000234");
					var ueinifdsa = getLanMsg("0ec22420-000175");
					showCfmMsgsch(ueinifdsa,msg2);
					var formStr = "";
					var pk_org_cgstszz = $("#pk_org_cgsts").val();
					formStr += "pk_org_cgsts="+pk_org_cgstszz+"&";
					var sysinitnumzz = $("#sysinitnum").val();
					formStr += "sysinitnum="+sysinitnumzz+"&";
					var iscgnumzz = $("#iscgnum").val();
					formStr += "iscgnum="+iscgnumzz+"&";
					var dqdatezz = $("#dqdate").val();
					formStr += "dqdate="+dqdatezz+"&";
					var purscherule_pkzz = $("#purscherule_pk").val();
					formStr += "purscherule_pk="+purscherule_pkzz+"&";
					var bijpkorgzz = $("#bijpkorg").val();
					formStr += "pk_org_cgs="+bijpkorgzz+"&";
					
					$("input[residfuck=resid"+rowsLoogp+"]").each(function(index, obj){
						var shjhnumsavalue = $(obj).val();
						//$(obj).parent().find("input:eq(6)").val();
						if(shjhnumsavalue != null){
							//var inputobj = $(obj).find("input");
							var displeyvalue = $(obj).parents(".data_amount_row").css("display");
							var pk_timecell_hzs = $(obj).parent().find("input:eq(1)").val();//$(inputobj[1]).val();
							var iscommitax = $(obj).parent().find("input:eq(6)").val();//$(inputobj[6]).val();
							//var isconfirmax = $(obj).parent().find("input:eq(2)").val();//$(inputobj[2]).val();
						//	if(pk_timecell_hzs != null && pk_timecell_hzs.length > 1 && iscommitax == 'false' && isconfirmax == 'true'){
							var shjhnumzxind = $(obj).parent().find("input:eq(0)").val();
							if("block" == displeyvalue && shjhnumzxind != "" && shjhnumzxind !=null && pk_timecell_hzs != null && pk_timecell_hzs.length > 1 && iscommitax == 'false'){
								var srcxinxzz = $(obj).parent().find("input:eq(13)").val();//$(inputobj[13]).val();
								formStr += "srcxinx="+srcxinxzz+"&";
								var isconfirmzz = $(obj).parent().find("input:eq(2)").val();//$(inputobj[2]).val();
								formStr += "isconfirm="+isconfirmzz+"&";
								var iscommitzz = $(obj).parent().find("input:eq(6)").val();//$(inputobj[6]).val();
								formStr += "iscommit="+iscommitzz+"&";
								var pk_timecell_hzz = $(obj).parent().find("input:eq(1)").val();//$(inputobj[1]).val();
								if(pk_timecell_hzz != null){
									var tpk_timecell_hzz = "";
									var wpk_timecell_hzz = "";
									if (pk_timecell_hzz.indexOf("editOrder") != -1){
										tpk_timecell_hzz = pk_timecell_hzz.substring(0,22);
										wpk_timecell_hzz = pk_timecell_hzz.substring(34,pk_timecell_hzz.length);
									} else {
										tpk_timecell_hzz = pk_timecell_hzz.substring(0,24);
										wpk_timecell_hzz = pk_timecell_hzz.substring(36,pk_timecell_hzz.length);
									}
									pk_timecell_hzz = tpk_timecell_hzz + wpk_timecell_hzz;
									pk_timecell_hzz = pk_timecell_hzz.replace("&","%26");
									pk_timecell_hzz = pk_timecell_hzz.replace("&","%26");
									pk_timecell_hzz = pk_timecell_hzz.replace("&","%26");
									pk_timecell_hzz = pk_timecell_hzz.replace("=","%3D");
									pk_timecell_hzz = pk_timecell_hzz.replace("=","%3D");
									pk_timecell_hzz = pk_timecell_hzz.replace("=","%3D");
								}
								formStr += "pk_timecell_h="+pk_timecell_hzz+"&";
								var shjhnumzz = $(obj).parent().find("input:eq(0)").val();//$(inputobj[0]).val();
								formStr += "shjhnum="+shjhnumzz+"&";
								var vehicle_tszz = $(obj).parent().find("input:eq(11)").val();//$(inputobj[11]).val();
								formStr += "vehicle_ts="+vehicle_tszz+"&";
							}
						}
					});
					$.ajax( {
						url : "/ebvp/schedulecoll/paichengconller/paichengfomcitj",
						type : "POST",
						//data : formStr, 
						data:formStr,//$("#fomcitj").serialize(), 
						dataType : "text",
						async : false,
						success : function(msg) {
						}
					});
					//function showResponseq(responseText, statusText, xhr, $form){
					//	alert("fdsdf");
					//}
					if(diogei == 1){
						var wulflvalue = $("#pk_marbasclass").val();
						$("#wulflvalueai").val(wulflvalue);
//					var newwulflvalue = wulflvalue.split(",");
						var wulflvaluename = $("#qrygoodsClass").val();
						$("#wulflvalueainame").val(wulflvaluename);
					}
					$("#fomcitj").attr("action","/ebvp/schedulecoll/paichengconller/paichengfomcitjzz");
			    	$("#fomcitj").submit();
					return false;
				} else {

					
					var lconcg = getLanMsg("0ec22420-000244");
					var msg23 = getLanMsg("0ec22420-000234");
					var uiofwenoi = getLanMsg("0ec22420-000175");
					var option = {
							title : uiofwenoi,
							content : msg23,
							confirm : function() {
						var formStr = "";
						var pk_org_cgstszz = $("#pk_org_cgsts").val();
						formStr += "pk_org_cgsts="+pk_org_cgstszz+"&";
						var sysinitnumzz = $("#sysinitnum").val();
						formStr += "sysinitnum="+sysinitnumzz+"&";
						var iscgnumzz = $("#iscgnum").val();
						formStr += "iscgnum="+iscgnumzz+"&";
						var dqdatezz = $("#dqdate").val();
						formStr += "dqdate="+dqdatezz+"&";
						var purscherule_pkzz = $("#purscherule_pk").val();
						formStr += "purscherule_pk="+purscherule_pkzz+"&";
						var bijpkorgzz = $("#bijpkorg").val();
						formStr += "pk_org_cgs="+bijpkorgzz+"&";
						
						$("input[residfuck=resid"+rowsLoogp+"]").each(function(index, obj){
							var shjhnumsavalue = $(obj).val();
							//$(obj).parent().find("input:eq(6)").val();
							if(shjhnumsavalue != null){
								//var inputobj = $(obj).find("input");
								var displeyvalue = $(obj).parents(".data_amount_row").css("display");
								var pk_timecell_hzs = $(obj).parent().find("input:eq(1)").val();//$(inputobj[1]).val();
								var iscommitax = $(obj).parent().find("input:eq(6)").val();//$(inputobj[6]).val();
								//var isconfirmax = $(obj).parent().find("input:eq(2)").val();//$(inputobj[2]).val();
							//	if(pk_timecell_hzs != null && pk_timecell_hzs.length > 1 && iscommitax == 'false' && isconfirmax == 'true'){
								var shjhnumzxind = $(obj).parent().find("input:eq(0)").val();
								if("block" == displeyvalue && shjhnumzxind != "" && shjhnumzxind !=null && pk_timecell_hzs != null && pk_timecell_hzs.length > 1 && iscommitax == 'false'){
									var srcxinxzz = $(obj).parent().find("input:eq(13)").val();//$(inputobj[13]).val();
									formStr += "srcxinx="+srcxinxzz+"&";
									var isconfirmzz = $(obj).parent().find("input:eq(2)").val();//$(inputobj[2]).val();
									formStr += "isconfirm="+isconfirmzz+"&";
									var iscommitzz = $(obj).parent().find("input:eq(6)").val();//$(inputobj[6]).val();
									formStr += "iscommit="+iscommitzz+"&";
									var pk_timecell_hzz = $(obj).parent().find("input:eq(1)").val();//$(inputobj[1]).val();
									if(pk_timecell_hzz != null){
										var tpk_timecell_hzz = "";
										var wpk_timecell_hzz = "";
										if (pk_timecell_hzz.indexOf("editOrder") != -1){
											tpk_timecell_hzz = pk_timecell_hzz.substring(0,22);
											wpk_timecell_hzz = pk_timecell_hzz.substring(34,pk_timecell_hzz.length);
										} else {
											tpk_timecell_hzz = pk_timecell_hzz.substring(0,24);
											wpk_timecell_hzz = pk_timecell_hzz.substring(36,pk_timecell_hzz.length);
										}
										pk_timecell_hzz = tpk_timecell_hzz + wpk_timecell_hzz;
										pk_timecell_hzz = pk_timecell_hzz.replace("&","%26");
										pk_timecell_hzz = pk_timecell_hzz.replace("&","%26");
										pk_timecell_hzz = pk_timecell_hzz.replace("&","%26");
										pk_timecell_hzz = pk_timecell_hzz.replace("=","%3D");
										pk_timecell_hzz = pk_timecell_hzz.replace("=","%3D");
										pk_timecell_hzz = pk_timecell_hzz.replace("=","%3D");
									}
									formStr += "pk_timecell_h="+pk_timecell_hzz+"&";
									var shjhnumzz = $(obj).parent().find("input:eq(0)").val();//$(inputobj[0]).val();
									formStr += "shjhnum="+shjhnumzz+"&";
									var vehicle_tszz = $(obj).parent().find("input:eq(11)").val();//$(inputobj[11]).val();
									formStr += "vehicle_ts="+vehicle_tszz+"&";
								}
							}
						});
						$.ajax( {
							url : "/ebvp/schedulecoll/paichengconller/paichengfomcitj",
							type : "POST",
							//data : formStr, 
							data:formStr,//$("#fomcitj").serialize(), 
							dataType : "text",
							async : false,
							success : function(msg) {
							
								alert(lconcg);
								if(diogei == 1){
									var wulflvalue = $("#pk_marbasclass").val();
									$("#wulflvalueai").val(wulflvalue);
		//						var newwulflvalue = wulflvalue.split(",");
									var wulflvaluename = $("#qrygoodsClass").val();
									$("#wulflvalueainame").val(wulflvaluename);
								}
									$("#fomcitj").attr("action","/ebvp/schedulecoll/paichengconller/paichengfomcitjzz");
									$("#fomcitj").submit();
								
								
								}
						});
						//function showResponseq(responseText, statusText, xhr, $form){
						//	alert("fdsdf");
						//}
						if(cltcdol == 0){
							if(diogei == 1){
								var wulflvalue = $("#pk_marbasclass").val();
								$("#wulflvalueai").val(wulflvalue);
	//						var newwulflvalue = wulflvalue.split(",");
								var wulflvaluename = $("#qrygoodsClass").val();
								$("#wulflvalueainame").val(wulflvaluename);
							}
							$("#fomcitj").attr("action","/ebvp/schedulecoll/paichengconller/paichengfomcitjzz");
					    	$("#fomcitj").submit();
						}
						
								return false;
							},
							cancel : function(){
							}
					};
					showConfirmDialogsch(option);
					//return false;
					
				}
//				return false;
			} else {
				var formStr = "";
				var pk_org_cgstszz = $("#pk_org_cgsts").val();
				formStr += "pk_org_cgsts="+pk_org_cgstszz+"&";
				var sysinitnumzz = $("#sysinitnum").val();
				formStr += "sysinitnum="+sysinitnumzz+"&";
				var iscgnumzz = $("#iscgnum").val();
				formStr += "iscgnum="+iscgnumzz+"&";
				var dqdatezz = $("#dqdate").val();
				formStr += "dqdate="+dqdatezz+"&";
				var purscherule_pkzz = $("#purscherule_pk").val();
				formStr += "purscherule_pk="+purscherule_pkzz+"&";
				var bijpkorgzz = $("#bijpkorg").val();
				formStr += "pk_org_cgs="+bijpkorgzz+"&";
				
				$("input[residfuck=resid"+rowsLoogp+"]").each(function(index, obj){
					var shjhnumsavalue = $(obj).val();
					//$(obj).parent().find("input:eq(6)").val();
					if(shjhnumsavalue != null){
						//var inputobj = $(obj).find("input");
						var displeyvalue = $(obj).parents(".data_amount_row").css("display");
						var pk_timecell_hzs = $(obj).parent().find("input:eq(1)").val();//$(inputobj[1]).val();
						var iscommitax = $(obj).parent().find("input:eq(6)").val();//$(inputobj[6]).val();
						//var isconfirmax = $(obj).parent().find("input:eq(2)").val();//$(inputobj[2]).val();
					//	if(pk_timecell_hzs != null && pk_timecell_hzs.length > 1 && iscommitax == 'false' && isconfirmax == 'true'){
						var shjhnumzxind = $(obj).parent().find("input:eq(0)").val();
						if("block" == displeyvalue && shjhnumzxind != "" && shjhnumzxind !=null && pk_timecell_hzs != null && pk_timecell_hzs.length > 1 && iscommitax == 'false'){
							var srcxinxzz = $(obj).parent().find("input:eq(13)").val();//$(inputobj[13]).val();
							formStr += "srcxinx="+srcxinxzz+"&";
							var isconfirmzz = $(obj).parent().find("input:eq(2)").val();//$(inputobj[2]).val();
							formStr += "isconfirm="+isconfirmzz+"&";
							var iscommitzz = $(obj).parent().find("input:eq(6)").val();//$(inputobj[6]).val();
							formStr += "iscommit="+iscommitzz+"&";
							var pk_timecell_hzz = $(obj).parent().find("input:eq(1)").val();//$(inputobj[1]).val();
							if(pk_timecell_hzz != null){
								var tpk_timecell_hzz = "";
								var wpk_timecell_hzz = "";
								if (pk_timecell_hzz.indexOf("editOrder") != -1){
									tpk_timecell_hzz = pk_timecell_hzz.substring(0,22);
									wpk_timecell_hzz = pk_timecell_hzz.substring(34,pk_timecell_hzz.length);
								} else {
									tpk_timecell_hzz = pk_timecell_hzz.substring(0,24);
									wpk_timecell_hzz = pk_timecell_hzz.substring(36,pk_timecell_hzz.length);
								}
								pk_timecell_hzz = tpk_timecell_hzz + wpk_timecell_hzz;
								pk_timecell_hzz = pk_timecell_hzz.replace("&","%26");
								pk_timecell_hzz = pk_timecell_hzz.replace("&","%26");
								pk_timecell_hzz = pk_timecell_hzz.replace("&","%26");
								pk_timecell_hzz = pk_timecell_hzz.replace("=","%3D");
								pk_timecell_hzz = pk_timecell_hzz.replace("=","%3D");
								pk_timecell_hzz = pk_timecell_hzz.replace("=","%3D");
							}
							formStr += "pk_timecell_h="+pk_timecell_hzz+"&";
							var shjhnumzz = $(obj).parent().find("input:eq(0)").val();//$(inputobj[0]).val();
							formStr += "shjhnum="+shjhnumzz+"&";
							var vehicle_tszz = $(obj).parent().find("input:eq(11)").val();//$(inputobj[11]).val();
							formStr += "vehicle_ts="+vehicle_tszz+"&";
						}
					}
				});
				$.ajax( {
					url : "/ebvp/schedulecoll/paichengconller/paichengfomcitj",
					type : "POST",
					//data : formStr, 
					data:formStr,//$("#fomcitj").serialize(), 
					dataType : "text",
					async : false,
					success : function(msg) {
						if(msg != null){
							var lconcg = getLanMsg("0ec22420-000244");
							var lconcgts = getLanMsg("0ec22420-000175");
							var option = {
									title : lconcgts,
									content : lconcg,
									confirm : function() {
								if(diogei == 1){
									var wulflvalue = $("#pk_marbasclass").val();
									$("#wulflvalueai").val(wulflvalue);
				//				var newwulflvalue = wulflvalue.split(",");
									var wulflvaluename = $("#qrygoodsClass").val();
									$("#wulflvalueainame").val(wulflvaluename);
								}
									$("#fomcitj").attr("action","/ebvp/schedulecoll/paichengconller/paichengfomcitjzz");
									$("#fomcitj").submit();
								},
								cancel : function(){
									alert("fsfd");
								}
							};
							showConfirmDialogsch(option);
						}
					}
				});
				//function showResponseq(responseText, statusText, xhr, $form){
				//	alert("fdsdf");
				//}
				if(cltcdol == 0){
					if(diogei == 1){
						var wulflvalue = $("#pk_marbasclass").val();
						$("#wulflvalueai").val(wulflvalue);
	//				var newwulflvalue = wulflvalue.split(",");
						var wulflvaluename = $("#qrygoodsClass").val();
						$("#wulflvalueainame").val(wulflvaluename);
					}
					$("#fomcitj").attr("action","/ebvp/schedulecoll/paichengconller/paichengfomcitjzz");
			    	$("#fomcitj").submit();
				}
				return false;
			}
			
		} else {
			var intfig = 0;
			var shifcsum = 0;
			var shulyanz = 0;
			var sysinitnum = $("#sysinitnum").val();
			$("input[name=iscommit]").each(function(index, obj){
				var iscommitvalue = $(obj).val();
				if(iscommitvalue == 'false'){
					var isconfirmvalue = $(obj).parent().find("input:eq(2)").val();
					if(isconfirmvalue == 'true'){
						intfig = intfig+1;
					}
				}
				if(iscommitvalue == 'false'){
					var isconfirmvalue = $(obj).parent().find("input:eq(2)").val();
					if(isconfirmvalue == 'true'){
						var shjhnum = $(obj).parent().find("input:eq(0)").val();
			        	var jisuanshjhnum = $(obj).parent().find("input:eq(12)").val();
			        	var jisuanrcvalue = sysinitnum;
			        	if(shjhnum != null && shjhnum != ""){
				        	var newjisuanshjhnuma = new Number(jisuanshjhnum) + new Number(jisuanshjhnum) * (jisuanrcvalue/100);
				        	if(new Number(shjhnum) > new Number(newjisuanshjhnuma)){
				        		shifcsum = shifcsum+1;
				        	}
			        	}
			        	if(shjhnum != null && shjhnum != ""){
			        		if("undefined" == typeof(shjhnum) || new Number(shjhnum) < 0){
			        		//if(new Number(shjhnum) < 0){
			        			var msg23 = getLanMsg("0ec22420-000168");
			        			var unrewi = getLanMsg("0ec22420-000175");
			            		showCfmMsg(unrewi,msg23);
			            		shulyanz = shulyanz+1;
			        		}
			        	}
			        	if("undefined" == typeof(shjhnum) || "" == shjhnum){
			        		var msg23 = getLanMsg("0ec22420-000168");
			        		var wiurwne = getLanMsg("0ec22420-000175");
			        		showCfmMsg(wiurwne,msg23);
		            		shulyanz = shulyanz+1;
			        	}
					}
				}
			});
			if(intfig == 0){
				var msg1 = getLanMsg("0ec22420-000174");
				var iowenmiofewa = getLanMsg("0ec22420-000175");
				showCfmMsg(iowenmiofewa,msg1);
				return false;
			}
			var iscgnum = $("#iscgnum").val();
			if(iscgnum == "false"){
				if(shifcsum != 0){
					if(sysinitnum == 0){
						var msg23 = getLanMsg("0ec22420-000233");
						var uenidwn = getLanMsg("0ec22420-000175");
						showCfmMsg(uenidwn,msg23);
					} else {
						var msg23 = getLanMsg("0ec22420-000169");
						var uenjbze = getLanMsg("0ec22420-000175");
						showCfmMsg(uenjbze,msg23+ sysinitnum +"%");
					}
					return false;
				}
			}
			if(shulyanz != 0){
				var msg23 = getLanMsg("0ec22420-000171");
				var uiondu = getLanMsg("0ec22420-000175");
				showCfmMsg(uenjbze,msg23);
				return false;
			}//
			var formStr = "";
			var pk_org_cgstszz = $("#pk_org_cgsts").val();
			formStr += "pk_org_cgsts="+pk_org_cgstszz+"&";
			var sysinitnumzz = $("#sysinitnum").val();
			formStr += "sysinitnum="+sysinitnumzz+"&";
			var iscgnumzz = $("#iscgnum").val();
			formStr += "iscgnum="+iscgnumzz+"&";
			var dqdatezz = $("#dqdate").val();
			formStr += "dqdate="+dqdatezz+"&";
			var purscherule_pkzz = $("#purscherule_pk").val();
			formStr += "purscherule_pk="+purscherule_pkzz+"&";
			var bijpkorgzz = $("#bijpkorg").val();
			formStr += "pk_org_cgs="+bijpkorgzz+"&";
			$("label[id=abs]").each(function(index, obj){
				var inputobj = $(obj).find("input");
				var pk_timecell_hzs = $(inputobj[1]).val();
				var iscommitax = $(inputobj[6]).val();
				var isconfirmax = $(inputobj[2]).val();
				if(pk_timecell_hzs != null && pk_timecell_hzs.length > 1 && iscommitax == 'false' && isconfirmax == 'true'){
					var srcxinxzz = $(inputobj[13]).val();
					formStr += "srcxinx="+srcxinxzz+"&";
					var isconfirmzz = $(inputobj[2]).val();
					formStr += "isconfirm="+isconfirmzz+"&";
					var iscommitzz = $(inputobj[6]).val();
					formStr += "iscommit="+iscommitzz+"&";
					var pk_timecell_hzz = $(inputobj[1]).val();
					if(pk_timecell_hzz != null){
//						var tpk_timecell_hzz = pk_timecell_hzz.substring(0,22);
//						var wpk_timecell_hzz = pk_timecell_hzz.substring(34,pk_timecell_hzz.length);
						var tpk_timecell_hzz = "";
						var wpk_timecell_hzz = "";
						if (pk_timecell_hzz.indexOf("editOrder") != -1){
							tpk_timecell_hzz = pk_timecell_hzz.substring(0,22);
							wpk_timecell_hzz = pk_timecell_hzz.substring(34,pk_timecell_hzz.length);
						} else {
							tpk_timecell_hzz = pk_timecell_hzz.substring(0,24);
							wpk_timecell_hzz = pk_timecell_hzz.substring(36,pk_timecell_hzz.length);
						}
						pk_timecell_hzz = tpk_timecell_hzz + wpk_timecell_hzz;
						///ebvp/order/editOrder?woije=woije&orderPk=1002A11000000003OBUZ&pkitemorder=1002A11000000003OBV0&pkWebOrder=&qryconfirmStatus=1
						///ebvp/order
						pk_timecell_hzz = pk_timecell_hzz.replace("&","%26");
						pk_timecell_hzz = pk_timecell_hzz.replace("&","%26");
						pk_timecell_hzz = pk_timecell_hzz.replace("&","%26");
						pk_timecell_hzz = pk_timecell_hzz.replace("=","%3D");
						pk_timecell_hzz = pk_timecell_hzz.replace("=","%3D");
						pk_timecell_hzz = pk_timecell_hzz.replace("=","%3D");
					}
					formStr += "pk_timecell_h="+pk_timecell_hzz+"&";
					var shjhnumzz = $(inputobj[0]).val();
					formStr += "shjhnum="+shjhnumzz+"&";
					var vehicle_tszz = $(inputobj[11]).val();
					formStr += "vehicle_ts="+vehicle_tszz+"&";
				}
			});
			$.ajax( {
				url : "/ebvp/schedulecoll/paichengconller/paichengfomcicommit",
				type : "POST",
				data:formStr,
				dataType : "text",
				async : false,
				success : showResponseb
			});
			function showResponseb(responseText, statusText, xhr, $form){
			}
			$("#fomcitj").attr("action","/ebvp/schedulecoll/paichengconller/paichengfomcicommitzz");
			$("#fomcitj").submit();
			return false;
		
		}
	});
});

function reset() {

	var scrollBarSize = ie7 ? 2 : 18;

	$("#scheduleContent").css( {
		'width' : $(window).width() - scrollBarSize,
		'height' : $(window).height() - scrollBarSize
	});

	$("#scheduleTable").css(
			{
				'width' : $(window).width() - scrollBarSize,
				'height' : $("#scheduleContent").height()
						- $("#scheduleTopBar").outerHeight(true) /* margin-top *//* border height */
			});

	$("#scheduleBody").css(
			{
				'height' : $("#scheduleTable").height()
						- $("#headerDateRow").height() - (ie7 ? 40 : 27),
				'paddingTop' : $("#headerDateRow").height() + 28
			});

	$("#legendPanel").css( {
		//'top' : $("#scheduleBody").height() + 27 + 15
	});

	$("#legendPanelje").css( {
		'top' : $("#scheduleBody").height() + 27+ 15
	});
	
	$(".scroll_row")
			.css(
					{
						'width' : $("#scheduleTable").width() - 355 /* 1st column with border width */- 76
					/* 2nd column with border width */});/*DAPIGU 191 298 325 355*/

	$("#headerDateRow").css( {
		'width' : $("#scheduleTable").width() - 355
	/* 1st column with border width */});/*DAPIGU 191 298 325 355*/

	$(".title_purchase").each(function() {
		var rows = $(this).parent().find(".data_amounts");
		var dataRowHeight = 0;
		for ( var rowsLoop = 0; rowsLoop < rows.length; rowsLoop++) {
			dataRowHeight += $(rows[rowsLoop]).height();
		}
		$(this).css( {
			'height' : dataRowHeight - 1
		});
	});
	/*DAPIGU 下面是新增加的*/
	$(".title_purchasewul").each(function() {
		var rows = $(this).parent().find(".title_purchase");
		var dataRowHeight = 0;
		for ( var rowsLoop = 0; rowsLoop < rows.length; rowsLoop++) {
			dataRowHeight += $(rows[rowsLoop]).height();
		}
		$(this).css( {
			'height' : dataRowHeight - 1 + 1
		});
	});
	if (ie7) {
		$(".cell_wrap").each(
				function() {
					$(this).parent().css( {
						'position' : "relative",
						'textAlign' : "left"
					});
					$(this).addClass("cell_wrap_ie7").removeClass("cell_wrap")
							.find(".cell_span").addClass("cell_span_ie7")
							.removeClass("cell_span");
				})
	}
	//var tableHeight = 0;
	for ( var loop = 0; loop < $("#scheduleBody").children().length; loop++) {
		tableHeight += $($("#scheduleBody").children().get(loop)).height();
	}

	var liWidth, areaWidth;
	$("ul")
			.each(
					function(index) {
						liWidth = 0;
						areaWidth = 0;
						if (index == 0) {
							for ( var loop11 = 0; loop11 < $(this).find(
									".confirmedlishi").length; loop11++) {
								areaWidth += $(
										$(this).find(".confirmedlishi")[loop11])
										.outerWidth(true);
							}
							$("#confirmedArealishi").css( {
								'width' : areaWidth - 1
							});
							areaWidth = 0;
							for ( var loop1 = 0; loop1 < $(this).find(
							".confirmed").length; loop1++) {
								areaWidth += $(
										$(this).find(".confirmed")[loop1])
										.outerWidth(true);
							}
							$("#confirmedArea").css( {
								'width' : areaWidth - 1
							});
							areaWidth = 0;
							for ( var loop2 = 0; loop2 < $(this).find(
									".submited").length; loop2++) {
								areaWidth += $($(this).find(".submited")[loop2])
										.outerWidth(true);
							}
							$("#submitedArea").css( {
								'width' : areaWidth - 1
							});
							areaWidth = 0;
							for ( var loop3 = 0; loop3 < $(this).find(
									".forecasted").length; loop3++) {
								areaWidth += $(
										$(this).find(".forecasted")[loop3])
										.outerWidth(true);
							}
							$("#forecastedArea").css( {
								'width' : areaWidth - 1
							});
						}
						for ( var loop = 0; loop < $(this).find("li").length; loop++) {
							liWidth += $($(this).find("li")[loop]).outerWidth(
									true);
						}
						$(this).css( {
							'width' : liWidth
						});
					});
	scrollWidth = $( "#headerDateRow ul" ).width() + 355 + 76 + 10;/*DAPIGU 191 298 325 355*/
	scrollHeight = tableHeight + 198;
	$( "body" ).css({ 'width': scrollWidth, 'height': scrollHeight });
}

function fixBar() {
	var scroller = $.browser.msie || $.browser.mozilla ? $(document)
			: $("body");
	var fixedTop = 0;
	if($($(".total_amount_row:first").children(":first")).offset() != null){
		fixedTop = $($(".total_amount_row:first").children(":first")).offset().top;
	} 
	$(".total_amount_row")
			.each(
					function(index) {
						var fixElement = $(this).css( {
							'width' : $("#scheduleBody").width(),
							'height' : $(this).height()
						}).children(":first");
						var nextElement = $(".total_amount_row").length > 1 ? index + 1 < $(".total_amount_row").length ? $(
								$(".total_amount_row").get(index + 1))
								.children(":first")
								: null
								: null;
						var spacing = 0;
						var scrolling = function() {
							if ($(fixElement).offset().top
									- scroller.scrollTop() <= fixedTop) {
								$(fixElement).css( {
									'position' : "fixed",
									'top' : fixedTop,
									'left' : 1,
									'right' : 0
								});
							}
							if (nextElement != null) {
								spacing = $(nextElement).offset().top
										- $(fixElement).offset().top;
								if (spacing <= $("#scheduleBody").height()
										- $(fixElement).height()) {
									$(fixElement).css( {
										'position' : "",
										'top' : "",
										'zIndex' : ""
									});
									$(fixElement).parent().find(".clear")
											.remove();
								} else {
									revert();
								}
							} else {
								revert();
							}
						};
						var revert = function() {
							if ($(fixElement).parent().position().top >= $(
									"#headerDateRow").height()) {
								$(fixElement).css( {
									'position' : "",
									'top' : "",
									'zIndex' : ""
								});
								$(fixElement).parent().find(".clear").remove();
							}
						};
						$( window ).scroll(scrolling);
					});
}
//截去多余的小数位数或者补足小数位
function subReduNum(objvalue,intPrecision){
	var strValue = objvalue.replace(/(^\s*)|(\s*$)/g, "");
	if(isNaN(strValue)){
		return;
	}
	if(strValue == null || strValue == ""){
		return;
	}
	if (strValue.indexOf(".") != -1){
		var values = strValue.split(".");
		if(values[1].length > intPrecision){
			if(intPrecision > 0){
				strValue = values[0] + "." + values[1].substring(0,intPrecision);
				strValue = roundNum(strValue,values[1].substring(intPrecision),intPrecision);
			}else{
				strValue = values[0];
			}
		}else{
			for(var i=values[1].length;i<intPrecision;i++){
				strValue += "0";
			}
		}
	}else{
		if(intPrecision > 0){
			if(strValue.indexOf(".") == -1){
				strValue += ".";
				for(var i=0;i<intPrecision;i++){
					strValue += "0";
				}
			}
		}
	}
	return strValue;
}

function subReduNumqud(objvalue,intPrecision){
	var strValue = objvalue.replace(/(^\s*)|(\s*$)/g, "");
	if(isNaN(strValue)){
		return;
	}
	if(strValue == null || strValue == ""){
		return;
	}
	if (strValue.indexOf(".") != -1){
		var values = strValue.split(".");
		if(values[1].length > intPrecision){
			if(intPrecision > 0){
				strValue = values[0] + "." + values[1].substring(0,intPrecision);
				strValue = roundNum(strValue,values[1].substring(intPrecision),intPrecision);
			}else{
				strValue = values[0];
			}
		}else{
			for(var i=values[1].length;i<intPrecision;i++){
				strValue += "0";
			}
		}
	}else{
		if(intPrecision > 0){
				strValue += ".";
				for(var i=0;i<intPrecision;i++){
					strValue += "0";
				}
		}
	}
	return strValue;
}

function settagLikl(key) {
	var obj = $("body").find("[resid='" + key + "']");
	if (null != obj) {
		// 单独处理登陆前首页的几个特殊项
		if (key == "ec22180-000254" || key == "ec22180-000255") {
			obj.attr("title", value);
		} else {
			if (obj.tagName == "INPUT" || obj.tagName == "input") {
				obj.val(value);
			} else if (obj.tagName == "IMG" || obj.tagName == "img") {
				obj.attr("alt", value);
			} else {
				obj.html(value);
			}
		}
	}
}

/**
 * 删除左右两端的空格
 * 
 * @param str
 * @return
 * @author zhenglq
 */
function trim(str){
	return str.replace(/(^\s*)|(\s*$)/g, "");
}

/**
 * 删除左右两端的空格
 * @param str
 * @return
 */
function trimStr(str){
	return str && typeof str === "string" ? str.replace(/(^\s*)|(\s*$)/g, ""):str;
}

/**
 * 删除左边的空格
 * @param str
 * @return
 * @author zhenglq
 */
function ltrim(str){ 
  return str.replace(/(^\s*)/g,"");
}

//去除字符串中间空格
function trimCenter(str){
	return str.replace(/\s/g,'');
}

function roundNum(oldValue,tailValue,intPrecision){
	var bAddOne = false;
	var numArray = new Array();
	for(var i=0;i<tailValue.length;i++){
		numArray[i] = tailValue.substring(i,i+1);
	}
	if(parseInt(numArray[0]) > 4){
		bAddOne = true;
	}else{
		for(var i=tailValue.length - 1;i>0;i--){
			if(parseInt(numArray[i]) > 4){
				numArray[i-1] = parseInt(numArray[i-1]) + 1;
			}
		}
		if(parseInt(numArray[0]) > 4){
			bAddOne = true;
		}
	}
	if(bAddOne){
		var strAddStr = "0.";
		for(var i=0;i<intPrecision;i++){
			if(i != intPrecision - 1){
				strAddStr = strAddStr + "0";
			}else{
				strAddStr = strAddStr + "1";
			}
		}
		oldValue = (parseFloat(oldValue) + parseFloat(strAddStr)) + "";
		if(oldValue.indexOf(".") != -1){
			var values = oldValue.split(".");
			oldValue = values[0] + "." + values[1].substring(0,intPrecision);
		} else {
			
			if(intPrecision > 0){
				oldValue += ".";
				for(var i=0;i<intPrecision;i++){
					oldValue += "0";
				}
			}
		}
	}
	return oldValue;
}